<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- Copyright 2016 TensorFlow authors.</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- you may not use this file except in compliance with the License.</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- You may obtain a copy of the License at</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">--     http://www.apache.org/licenses/LICENSE-2.0</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Unless required by applicable law or agreed to in writing, software</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- See the License for the specific language governing permissions and</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- limitations under the License.</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-pragma">{-# LANGUAGE ConstraintKinds #-}</span><span>
</span><span id="line-16"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-17"></span><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
</span><span id="line-18"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-19"></span><span class="hs-pragma">{-# LANGUAGE FlexibleInstances #-}</span><span>
</span><span id="line-20"></span><span class="hs-pragma">{-# LANGUAGE GADTs #-}</span><span>
</span><span id="line-21"></span><span class="hs-pragma">{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span><span>
</span><span id="line-22"></span><span class="hs-pragma">{-# LANGUAGE MonoLocalBinds #-}</span><span>
</span><span id="line-23"></span><span class="hs-pragma">{-# LANGUAGE MultiParamTypeClasses #-}</span><span>
</span><span id="line-24"></span><span class="hs-pragma">{-# LANGUAGE OverloadedStrings #-}</span><span>
</span><span id="line-25"></span><span class="hs-pragma">{-# LANGUAGE RankNTypes #-}</span><span>
</span><span id="line-26"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-27"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-28"></span><span class="hs-pragma">{-# LANGUAGE TypeOperators #-}</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- We use UndecidableInstances for type families with recursive definitions</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- like &quot;\\&quot;.  Those instances will terminate since each equation unwraps one</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- cons cell of a type-level list.</span><span>
</span><span id="line-32"></span><span class="hs-pragma">{-# LANGUAGE UndecidableInstances #-}</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">TensorFlow.Types</span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier">TensorType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier">TensorData</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier">TensorDataType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Scalar"><span class="hs-identifier">Scalar</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier">Shape</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#protoShape"><span class="hs-identifier">protoShape</span></a></span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier">Attribute</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">DataType</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ResourceHandle"><span class="hs-identifier">ResourceHandle</span></a></span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Variant"><span class="hs-identifier">Variant</span></a></span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Lists</span></span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier">ListOf</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#List"><span class="hs-identifier">List</span></a></span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3A%2F"><span class="hs-operator">(/:/)</span></a></span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier">TensorTypeProxy</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier">TensorTypes</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeList"><span class="hs-identifier">TensorTypeList</span></a></span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#fromTensorTypeList"><span class="hs-identifier">fromTensorTypeList</span></a></span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#fromTensorTypes"><span class="hs-identifier">fromTensorTypes</span></a></span><span>
</span><span id="line-54"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Type constraints</span></span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#OneOf"><span class="hs-identifier">OneOf</span></a></span><span>
</span><span id="line-56"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">type</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator">(/=)</span></a></span><span>
</span><span id="line-57"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#OneOfs"><span class="hs-identifier">OneOfs</span></a></span><span>
</span><span id="line-58"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Implementation of constraints</span></span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TypeError"><span class="hs-identifier">TypeError</span></a></span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ExcludedCase"><span class="hs-identifier">ExcludedCase</span></a></span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier">NoneOf</span></a></span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">type</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier">Delete</span></a></span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#AllTensorTypes"><span class="hs-identifier">AllTensorTypes</span></a></span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ProtoLens.Message</span></span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">defMessage</span></span><span class="hs-special">)</span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Functor.Identity</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Identity</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Complex</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Complex</span></span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Int</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Int8</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Int16</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Int32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Int64</span></span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Maybe</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">fromMaybe</span></span><span class="hs-special">)</span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ProtoLens.TextFormat</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">showMessageShort</span></span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Proxy</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Proxy</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.String</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">IsString</span></span><span class="hs-special">)</span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Word</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Word8</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Word16</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Word32</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">Word64</span></span><span class="hs-special">)</span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Foreign.Storable</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Storable</span></span><span class="hs-special">)</span><span>
</span><span id="line-77"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">GHC.Exts</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Constraint</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">IsList</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-78"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Lens.Family2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Lens'</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">view</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&amp;)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(.~)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(^..)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">under</span></span><span class="hs-special">)</span><span>
</span><span id="line-79"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Lens.Family2.Unchecked</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">adapter</span></span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Text.Printf</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">printf</span></span><span class="hs-special">)</span><span>
</span><span id="line-81"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Attoparsec.ByteString</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Atto</span></span><span>
</span><span id="line-82"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ByteString</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">ByteString</span></span><span class="hs-special">)</span><span>
</span><span id="line-83"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.ByteString</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">B</span></span><span>
</span><span id="line-84"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ByteString.Builder</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Builder</span></span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.ByteString.Builder</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Builder</span></span><span>
</span><span id="line-86"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.ByteString.Lazy</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span>
</span><span id="line-87"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Vector</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">V</span></span><span>
</span><span id="line-88"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Vector.Storable</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-89"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.AttrValue</span></span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">AttrValue</span></span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">AttrValue'ListValue</span></span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-93"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.AttrValue_Fields</span></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">b</span></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">f</span></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">i</span></span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">s</span></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">list</span></span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">type'</span></span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">shape</span></span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">tensor</span></span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.ResourceHandle</span></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">ResourceHandleProto</span></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.Tensor</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Tensor</span></span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">TensorProto</span></span><span class="hs-special">)</span><span>
</span><span id="line-108"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.Tensor_Fields</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Tensor</span></span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">boolVal</span></span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">doubleVal</span></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">floatVal</span></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">intVal</span></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">int64Val</span></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">resourceHandleVal</span></span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">stringVal</span></span><span>
</span><span id="line-116"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">uint32Val</span></span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">uint64Val</span></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.TensorShape</span></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">TensorShapeProto</span></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.TensorShape_Fields</span></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">dim</span></span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">size</span></span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">unknownRank</span></span><span>
</span><span id="line-126"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.Types</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">DataType</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="TensorFlow.Internal.VarInt.html"><span class="hs-identifier">TensorFlow.Internal.VarInt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Internal.VarInt.html#getVarInt"><span class="hs-identifier">getVarInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Internal.VarInt.html#putVarInt"><span class="hs-identifier">putVarInt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="TensorFlow.Internal.FFI.html"><span class="hs-identifier">TensorFlow.Internal.FFI</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">FFI</span></span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="hs-keyword">type</span><span> </span><span id="ResourceHandle"><span class="annot"><a href="TensorFlow.Types.html#ResourceHandle"><span class="hs-identifier hs-var">ResourceHandle</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ResourceHandleProto</span></span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span class="hs-comment">-- | Dynamic type.</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- TensorFlow variants aren't supported yet. This type acts a placeholder to</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- simplify op generation.</span><span>
</span><span id="line-137"></span><span class="hs-keyword">data</span><span> </span><span id="Variant"><span class="annot"><a href="TensorFlow.Types.html#Variant"><span class="hs-identifier hs-var">Variant</span></a></span></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-comment">-- | The class of scalar types supported by tensorflow.</span><span>
</span><span id="line-140"></span><span class="hs-keyword">class</span><span> </span><span id="TensorType"><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-var">TensorType</span></a></span></span><span> </span><span id="local-6989586621679164973"><span class="annot"><a href="#local-6989586621679164973"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-141"></span><span>    </span><span id="tensorType"><span class="annot"><a href="TensorFlow.Types.html#tensorType"><span class="hs-identifier hs-type">tensorType</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164973"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span>
</span><span id="line-142"></span><span>    </span><span id="tensorRefType"><span class="annot"><a href="TensorFlow.Types.html#tensorRefType"><span class="hs-identifier hs-type">tensorRefType</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164973"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span>
</span><span id="line-143"></span><span>    </span><span id="tensorVal"><span class="annot"><a href="TensorFlow.Types.html#tensorVal"><span class="hs-identifier hs-type">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Lens'</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorProto</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679164973"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-146"></span><span>    </span><span id="local-6989586621679164626"><span class="annot"><span class="annottext">tensorType :: Float -&gt; DataType
</span><a href="#local-6989586621679164626"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_FLOAT</span></span><span>
</span><span id="line-147"></span><span>    </span><span id="local-6989586621679164624"><span class="annot"><span class="annottext">tensorRefType :: Float -&gt; DataType
</span><a href="#local-6989586621679164624"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_FLOAT_REF</span></span><span>
</span><span id="line-148"></span><span>    </span><span id="local-6989586621679164622"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Float]
</span><a href="#local-6989586621679164622"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Float]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;floatVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">floatVal</span></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-151"></span><span>    </span><span id="local-6989586621679164618"><span class="annot"><span class="annottext">tensorType :: Double -&gt; DataType
</span><a href="#local-6989586621679164618"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_DOUBLE</span></span><span>
</span><span id="line-152"></span><span>    </span><span id="local-6989586621679164616"><span class="annot"><span class="annottext">tensorRefType :: Double -&gt; DataType
</span><a href="#local-6989586621679164616"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_DOUBLE_REF</span></span><span>
</span><span id="line-153"></span><span>    </span><span id="local-6989586621679164614"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Double]
</span><a href="#local-6989586621679164614"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Double]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;doubleVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">doubleVal</span></span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-156"></span><span>    </span><span id="local-6989586621679164610"><span class="annot"><span class="annottext">tensorType :: Int32 -&gt; DataType
</span><a href="#local-6989586621679164610"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT32</span></span><span>
</span><span id="line-157"></span><span>    </span><span id="local-6989586621679164608"><span class="annot"><span class="annottext">tensorRefType :: Int32 -&gt; DataType
</span><a href="#local-6989586621679164608"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT32_REF</span></span><span>
</span><span id="line-158"></span><span>    </span><span id="local-6989586621679164606"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Int32]
</span><a href="#local-6989586621679164606"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;intVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">intVal</span></span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-161"></span><span>    </span><span id="local-6989586621679164602"><span class="annot"><span class="annottext">tensorType :: Int64 -&gt; DataType
</span><a href="#local-6989586621679164602"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT64</span></span><span>
</span><span id="line-162"></span><span>    </span><span id="local-6989586621679164600"><span class="annot"><span class="annottext">tensorRefType :: Int64 -&gt; DataType
</span><a href="#local-6989586621679164600"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT64_REF</span></span><span>
</span><span id="line-163"></span><span>    </span><span id="local-6989586621679164598"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Int64]
</span><a href="#local-6989586621679164598"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int64]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;int64Val&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">int64Val</span></span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span id="local-6989586621679164931"><span class="annot"><a href="TensorFlow.Types.html#integral"><span class="hs-identifier hs-type">integral</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integral</span></span><span> </span><span class="annot"><a href="#local-6989586621679164931"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Lens'</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679164931"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-166"></span><span id="integral"><span class="annot"><span class="annottext">integral :: Lens' [Int32] [a]
</span><a href="TensorFlow.Types.html#integral"><span class="hs-identifier hs-var hs-var">integral</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Resetter [Int32] (f [Int32]) [a] (f [a])
-&gt; ([a] -&gt; f [a]) -&gt; [Int32] -&gt; f [Int32]
forall s t a b. Resetter s t a b -&gt; (a -&gt; b) -&gt; s -&gt; t
</span><span class="hs-identifier hs-var">under</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([Int32] -&gt; [a])
-&gt; ([a] -&gt; [Int32]) -&gt; Adapter [Int32] [Int32] [a] [a]
forall s a b t. (s -&gt; a) -&gt; (b -&gt; t) -&gt; Adapter s t a b
</span><span class="hs-identifier hs-var">adapter</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Int32 -&gt; a) -&gt; [Int32] -&gt; [a]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-identifier hs-var">fmap</span></span><span> </span><span class="annot"><span class="annottext">Int32 -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Int32) -&gt; [a] -&gt; [Int32]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-identifier hs-var">fmap</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word8</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-169"></span><span>    </span><span id="local-6989586621679164593"><span class="annot"><span class="annottext">tensorType :: Word8 -&gt; DataType
</span><a href="#local-6989586621679164593"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT8</span></span><span>
</span><span id="line-170"></span><span>    </span><span id="local-6989586621679164591"><span class="annot"><span class="annottext">tensorRefType :: Word8 -&gt; DataType
</span><a href="#local-6989586621679164591"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT8_REF</span></span><span>
</span><span id="line-171"></span><span>    </span><span id="local-6989586621679164589"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Word8]
</span><a href="#local-6989586621679164589"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;intVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">intVal</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
-&gt; (([Word8] -&gt; f [Word8]) -&gt; [Int32] -&gt; f [Int32])
-&gt; LensLike' f TensorProto [Word8]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">([Word8] -&gt; f [Word8]) -&gt; [Int32] -&gt; f [Int32]
forall a. Integral a =&gt; Lens' [Int32] [a]
</span><a href="TensorFlow.Types.html#integral"><span class="hs-identifier hs-var">integral</span></a></span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word16</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-174"></span><span>    </span><span id="local-6989586621679164584"><span class="annot"><span class="annottext">tensorType :: Word16 -&gt; DataType
</span><a href="#local-6989586621679164584"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT16</span></span><span>
</span><span id="line-175"></span><span>    </span><span id="local-6989586621679164582"><span class="annot"><span class="annottext">tensorRefType :: Word16 -&gt; DataType
</span><a href="#local-6989586621679164582"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT16_REF</span></span><span>
</span><span id="line-176"></span><span>    </span><span id="local-6989586621679164580"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Word16]
</span><a href="#local-6989586621679164580"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;intVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">intVal</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
-&gt; (([Word16] -&gt; f [Word16]) -&gt; [Int32] -&gt; f [Int32])
-&gt; LensLike' f TensorProto [Word16]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">([Word16] -&gt; f [Word16]) -&gt; [Int32] -&gt; f [Int32]
forall a. Integral a =&gt; Lens' [Int32] [a]
</span><a href="TensorFlow.Types.html#integral"><span class="hs-identifier hs-var">integral</span></a></span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word32</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-179"></span><span>    </span><span id="local-6989586621679164576"><span class="annot"><span class="annottext">tensorType :: Word32 -&gt; DataType
</span><a href="#local-6989586621679164576"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT32</span></span><span>
</span><span id="line-180"></span><span>    </span><span id="local-6989586621679164574"><span class="annot"><span class="annottext">tensorRefType :: Word32 -&gt; DataType
</span><a href="#local-6989586621679164574"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT32_REF</span></span><span>
</span><span id="line-181"></span><span>    </span><span id="local-6989586621679164572"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Word32]
</span><a href="#local-6989586621679164572"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Word32]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;uint32Val&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">uint32Val</span></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word64</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-184"></span><span>    </span><span id="local-6989586621679164568"><span class="annot"><span class="annottext">tensorType :: Word64 -&gt; DataType
</span><a href="#local-6989586621679164568"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT64</span></span><span>
</span><span id="line-185"></span><span>    </span><span id="local-6989586621679164566"><span class="annot"><span class="annottext">tensorRefType :: Word64 -&gt; DataType
</span><a href="#local-6989586621679164566"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_UINT64_REF</span></span><span>
</span><span id="line-186"></span><span>    </span><span id="local-6989586621679164564"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Word64]
</span><a href="#local-6989586621679164564"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Word64]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;uint64Val&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">uint64Val</span></span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int16</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-189"></span><span>    </span><span id="local-6989586621679164560"><span class="annot"><span class="annottext">tensorType :: Int16 -&gt; DataType
</span><a href="#local-6989586621679164560"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT16</span></span><span>
</span><span id="line-190"></span><span>    </span><span id="local-6989586621679164558"><span class="annot"><span class="annottext">tensorRefType :: Int16 -&gt; DataType
</span><a href="#local-6989586621679164558"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT16_REF</span></span><span>
</span><span id="line-191"></span><span>    </span><span id="local-6989586621679164556"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Int16]
</span><a href="#local-6989586621679164556"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;intVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">intVal</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
-&gt; (([Int16] -&gt; f [Int16]) -&gt; [Int32] -&gt; f [Int32])
-&gt; LensLike' f TensorProto [Int16]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">([Int16] -&gt; f [Int16]) -&gt; [Int32] -&gt; f [Int32]
forall a. Integral a =&gt; Lens' [Int32] [a]
</span><a href="TensorFlow.Types.html#integral"><span class="hs-identifier hs-var">integral</span></a></span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int8</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-194"></span><span>    </span><span id="local-6989586621679164552"><span class="annot"><span class="annottext">tensorType :: Int8 -&gt; DataType
</span><a href="#local-6989586621679164552"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT8</span></span><span>
</span><span id="line-195"></span><span>    </span><span id="local-6989586621679164550"><span class="annot"><span class="annottext">tensorRefType :: Int8 -&gt; DataType
</span><a href="#local-6989586621679164550"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_INT8_REF</span></span><span>
</span><span id="line-196"></span><span>    </span><span id="local-6989586621679164548"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Int8]
</span><a href="#local-6989586621679164548"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;intVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">intVal</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Int32]
-&gt; (([Int8] -&gt; f [Int8]) -&gt; [Int32] -&gt; f [Int32])
-&gt; LensLike' f TensorProto [Int8]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">([Int8] -&gt; f [Int8]) -&gt; [Int32] -&gt; f [Int32]
forall a. Integral a =&gt; Lens' [Int32] [a]
</span><a href="TensorFlow.Types.html#integral"><span class="hs-identifier hs-var">integral</span></a></span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-199"></span><span>    </span><span id="local-6989586621679164544"><span class="annot"><span class="annottext">tensorType :: ByteString -&gt; DataType
</span><a href="#local-6989586621679164544"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_STRING</span></span><span>
</span><span id="line-200"></span><span>    </span><span id="local-6989586621679164542"><span class="annot"><span class="annottext">tensorRefType :: ByteString -&gt; DataType
</span><a href="#local-6989586621679164542"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_STRING_REF</span></span><span>
</span><span id="line-201"></span><span>    </span><span id="local-6989586621679164540"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [ByteString]
</span><a href="#local-6989586621679164540"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [ByteString]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;stringVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">stringVal</span></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-204"></span><span>    </span><span id="local-6989586621679164536"><span class="annot"><span class="annottext">tensorType :: Bool -&gt; DataType
</span><a href="#local-6989586621679164536"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_BOOL</span></span><span>
</span><span id="line-205"></span><span>    </span><span id="local-6989586621679164534"><span class="annot"><span class="annottext">tensorRefType :: Bool -&gt; DataType
</span><a href="#local-6989586621679164534"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_BOOL_REF</span></span><span>
</span><span id="line-206"></span><span>    </span><span id="local-6989586621679164532"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Bool]
</span><a href="#local-6989586621679164532"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [Bool]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;boolVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">boolVal</span></span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-209"></span><span>    </span><span id="local-6989586621679164528"><span class="annot"><span class="annottext">tensorType :: Complex Float -&gt; DataType
</span><a href="#local-6989586621679164528"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_COMPLEX64</span></span><span>
</span><span id="line-210"></span><span>    </span><span id="local-6989586621679164526"><span class="annot"><span class="annottext">tensorRefType :: Complex Float -&gt; DataType
</span><a href="#local-6989586621679164526"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_COMPLEX64</span></span><span>
</span><span id="line-211"></span><span>    </span><span id="local-6989586621679164525"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Complex Float]
</span><a href="#local-6989586621679164525"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; LensLike' f TensorProto [Complex Float]
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO (Complex Float)&quot;</span></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-214"></span><span>    </span><span id="local-6989586621679164520"><span class="annot"><span class="annottext">tensorType :: Complex Double -&gt; DataType
</span><a href="#local-6989586621679164520"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_COMPLEX128</span></span><span>
</span><span id="line-215"></span><span>    </span><span id="local-6989586621679164518"><span class="annot"><span class="annottext">tensorRefType :: Complex Double -&gt; DataType
</span><a href="#local-6989586621679164518"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_COMPLEX128</span></span><span>
</span><span id="line-216"></span><span>    </span><span id="local-6989586621679164517"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Complex Double]
</span><a href="#local-6989586621679164517"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; LensLike' f TensorProto [Complex Double]
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO (Complex Double)&quot;</span></span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ResourceHandle"><span class="hs-identifier hs-type">ResourceHandle</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-219"></span><span>    </span><span id="local-6989586621679164513"><span class="annot"><span class="annottext">tensorType :: ResourceHandle -&gt; DataType
</span><a href="#local-6989586621679164513"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_RESOURCE</span></span><span>
</span><span id="line-220"></span><span>    </span><span id="local-6989586621679164511"><span class="annot"><span class="annottext">tensorRefType :: ResourceHandle -&gt; DataType
</span><a href="#local-6989586621679164511"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_RESOURCE_REF</span></span><span>
</span><span id="line-221"></span><span>    </span><span id="local-6989586621679164509"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [ResourceHandle]
</span><a href="#local-6989586621679164509"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorProto [ResourceHandle]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;resourceHandleVal&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">resourceHandleVal</span></span><span>
</span><span id="line-222"></span><span>
</span><span id="line-223"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Variant"><span class="hs-identifier hs-type">Variant</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-224"></span><span>    </span><span id="local-6989586621679164505"><span class="annot"><span class="annottext">tensorType :: Variant -&gt; DataType
</span><a href="#local-6989586621679164505"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_VARIANT</span></span><span>
</span><span id="line-225"></span><span>    </span><span id="local-6989586621679164503"><span class="annot"><span class="annottext">tensorRefType :: Variant -&gt; DataType
</span><a href="#local-6989586621679164503"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorRefType</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_VARIANT_REF</span></span><span>
</span><span id="line-226"></span><span>    </span><span id="local-6989586621679164501"><span class="annot"><span class="annottext">tensorVal :: LensLike' f TensorProto [Variant]
</span><a href="#local-6989586621679164501"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorVal</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; LensLike' f TensorProto [Variant]
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO Variant&quot;</span></span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="hs-comment">-- | Tensor data with the correct memory layout for tensorflow.</span><span>
</span><span id="line-229"></span><span class="hs-keyword">newtype</span><span> </span><span id="TensorData"><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-var">TensorData</span></a></span></span><span> </span><span id="local-6989586621679164889"><span class="annot"><a href="#local-6989586621679164889"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="TensorData"><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-var">TensorData</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="unTensorData"><span class="annot"><span class="annottext">TensorData a -&gt; TensorData
</span><a href="TensorFlow.Types.html#unTensorData"><span class="hs-identifier hs-var hs-var">unTensorData</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Internal.FFI.html#TensorData"><span class="hs-identifier hs-type">FFI.TensorData</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-comment">-- | Types that can be converted to and from 'TensorData'.</span><span>
</span><span id="line-232"></span><span class="hs-comment">--</span><span>
</span><span id="line-233"></span><span class="hs-comment">-- 'S.Vector' is the most efficient to encode/decode for most element types.</span><span>
</span><span id="line-234"></span><span class="hs-keyword">class</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164873"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span id="TensorDataType"><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-var">TensorDataType</span></a></span></span><span> </span><span id="local-6989586621679164872"><span class="annot"><a href="#local-6989586621679164872"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span id="local-6989586621679164873"><span class="annot"><a href="#local-6989586621679164873"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-235"></span><span>    </span><span class="hs-comment">-- | Decode the bytes of a 'TensorData' into an 's'.</span><span>
</span><span id="line-236"></span><span>    </span><span id="decodeTensorData"><span class="annot"><a href="TensorFlow.Types.html#decodeTensorData"><span class="hs-identifier hs-type">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-type">TensorData</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164873"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679164872"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164873"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-237"></span><span>    </span><span class="hs-comment">-- | Encode an 's' into a 'TensorData'.</span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-239"></span><span>    </span><span class="hs-comment">-- The values should be in row major order, e.g.,</span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-241"></span><span>    </span><span class="hs-comment">--   element 0:   index (0, ..., 0)</span><span>
</span><span id="line-242"></span><span>    </span><span class="hs-comment">--   element 1:   index (0, ..., 1)</span><span>
</span><span id="line-243"></span><span>    </span><span class="hs-comment">--   ...</span><span>
</span><span id="line-244"></span><span>    </span><span id="encodeTensorData"><span class="annot"><a href="TensorFlow.Types.html#encodeTensorData"><span class="hs-identifier hs-type">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679164872"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164873"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-type">TensorData</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164873"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span class="hs-comment">-- All types, besides ByteString and Bool, are encoded as simple arrays and we</span><span>
</span><span id="line-247"></span><span class="hs-comment">-- can use Vector.Storable to encode/decode by type casting pointers.</span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span class="hs-comment">-- TODO(fmayle): Assert that the data type matches the return type.</span><span>
</span><span id="line-250"></span><span id="local-6989586621679164871"><span class="annot"><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-type">simpleDecode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Storable</span></span><span> </span><span class="annot"><a href="#local-6989586621679164871"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-type">TensorData</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164871"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164871"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-251"></span><span id="simpleDecode"><span class="annot"><span class="annottext">simpleDecode :: TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var hs-var">simpleDecode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Vector Word8 -&gt; Vector a
forall a b. (Storable a, Storable b) =&gt; Vector a -&gt; Vector b
</span><span class="hs-identifier hs-var">S.unsafeCast</span></span><span> </span><span class="annot"><span class="annottext">(Vector Word8 -&gt; Vector a)
-&gt; (TensorData a -&gt; Vector Word8) -&gt; TensorData a -&gt; Vector a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TensorData -&gt; Vector Word8
</span><a href="TensorFlow.Internal.FFI.html#tensorDataBytes"><span class="hs-identifier hs-var hs-var">FFI.tensorDataBytes</span></a></span><span> </span><span class="annot"><span class="annottext">(TensorData -&gt; Vector Word8)
-&gt; (TensorData a -&gt; TensorData) -&gt; TensorData a -&gt; Vector Word8
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TensorData a -&gt; TensorData
forall a. TensorData a -&gt; TensorData
</span><a href="TensorFlow.Types.html#unTensorData"><span class="hs-identifier hs-var hs-var">unTensorData</span></a></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="annot"><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-type">simpleEncode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679164870"><span class="annot"><a href="#local-6989586621679164870"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164870"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Storable</span></span><span> </span><span class="annot"><a href="#local-6989586621679164870"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>             </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164870"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-type">TensorData</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164870"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-255"></span><span id="simpleEncode"><span class="annot"><span class="annottext">simpleEncode :: Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var hs-var">simpleEncode</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span id="local-6989586621679164491"><span class="annot"><span class="annottext">xs :: [Int64]
</span><a href="#local-6989586621679164491"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164490"><span class="annot"><span class="annottext">v :: Vector a
</span><a href="#local-6989586621679164490"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-256"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; Int64
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><span class="hs-identifier hs-var">product</span></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164491"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int64 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector a -&gt; Int
forall a. Storable a =&gt; Vector a -&gt; Int
</span><span class="hs-identifier hs-var">S.length</span></span><span> </span><span class="annot"><span class="annottext">Vector a
</span><a href="#local-6989586621679164490"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-257"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; TensorData a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; TensorData a) -&gt; [Char] -&gt; TensorData a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; Int64 -&gt; Int -&gt; [Char]
forall r. PrintfType r =&gt; [Char] -&gt; r
</span><span class="hs-identifier hs-var">printf</span></span><span>
</span><span id="line-258"></span><span>            </span><span class="annot"><span class="hs-string">&quot;simpleEncode: bad vector length for shape %v: expected=%d got=%d&quot;</span></span><span>
</span><span id="line-259"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int64] -&gt; [Char]
forall a. Show a =&gt; a -&gt; [Char]
</span><span class="hs-identifier hs-var">show</span></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164491"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int64] -&gt; Int64
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><span class="hs-identifier hs-var">product</span></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164491"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector a -&gt; Int
forall a. Storable a =&gt; Vector a -&gt; Int
</span><span class="hs-identifier hs-var">S.length</span></span><span> </span><span class="annot"><span class="annottext">Vector a
</span><a href="#local-6989586621679164490"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-260"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">TensorData -&gt; TensorData a
forall a. TensorData -&gt; TensorData a
</span><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-var">TensorData</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int64] -&gt; DataType -&gt; Vector Word8 -&gt; TensorData
</span><a href="TensorFlow.Internal.FFI.html#TensorData"><span class="hs-identifier hs-var">FFI.TensorData</span></a></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164491"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="#local-6989586621679164484"><span class="hs-identifier hs-var">dt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector a -&gt; Vector Word8
forall a b. (Storable a, Storable b) =&gt; Vector a -&gt; Vector b
</span><span class="hs-identifier hs-var">S.unsafeCast</span></span><span> </span><span class="annot"><span class="annottext">Vector a
</span><a href="#local-6989586621679164490"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-262"></span><span>    </span><span id="local-6989586621679164484"><span class="annot"><span class="annottext">dt :: DataType
</span><a href="#local-6989586621679164484"><span class="hs-identifier hs-var hs-var">dt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><a href="TensorFlow.Types.html#tensorType"><span class="hs-identifier hs-var">tensorType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164870"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-265"></span><span>    </span><span id="local-6989586621679164478"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Float -&gt; Vector Float
</span><a href="#local-6989586621679164478"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Float -&gt; Vector Float
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-266"></span><span>    </span><span id="local-6989586621679164477"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Float -&gt; TensorData Float
</span><a href="#local-6989586621679164477"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Float -&gt; TensorData Float
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-269"></span><span>    </span><span id="local-6989586621679164473"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Double -&gt; Vector Double
</span><a href="#local-6989586621679164473"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Double -&gt; Vector Double
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-270"></span><span>    </span><span id="local-6989586621679164472"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Double -&gt; TensorData Double
</span><a href="#local-6989586621679164472"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Double -&gt; TensorData Double
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int8</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-273"></span><span>    </span><span id="local-6989586621679164468"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Int8 -&gt; Vector Int8
</span><a href="#local-6989586621679164468"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Int8 -&gt; Vector Int8
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-274"></span><span>    </span><span id="local-6989586621679164467"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Int8 -&gt; TensorData Int8
</span><a href="#local-6989586621679164467"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Int8 -&gt; TensorData Int8
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int16</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-277"></span><span>    </span><span id="local-6989586621679164463"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Int16 -&gt; Vector Int16
</span><a href="#local-6989586621679164463"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Int16 -&gt; Vector Int16
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-278"></span><span>    </span><span id="local-6989586621679164462"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Int16 -&gt; TensorData Int16
</span><a href="#local-6989586621679164462"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Int16 -&gt; TensorData Int16
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-279"></span><span>
</span><span id="line-280"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-281"></span><span>    </span><span id="local-6989586621679164458"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Int32 -&gt; Vector Int32
</span><a href="#local-6989586621679164458"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Int32 -&gt; Vector Int32
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-282"></span><span>    </span><span id="local-6989586621679164457"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Int32 -&gt; TensorData Int32
</span><a href="#local-6989586621679164457"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Int32 -&gt; TensorData Int32
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-285"></span><span>    </span><span id="local-6989586621679164453"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Int64 -&gt; Vector Int64
</span><a href="#local-6989586621679164453"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Int64 -&gt; Vector Int64
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-286"></span><span>    </span><span id="local-6989586621679164452"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Int64 -&gt; TensorData Int64
</span><a href="#local-6989586621679164452"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Int64 -&gt; TensorData Int64
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-287"></span><span>
</span><span id="line-288"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word8</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-289"></span><span>    </span><span id="local-6989586621679164448"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Word8 -&gt; Vector Word8
</span><a href="#local-6989586621679164448"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Word8 -&gt; Vector Word8
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-290"></span><span>    </span><span id="local-6989586621679164447"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Word8 -&gt; TensorData Word8
</span><a href="#local-6989586621679164447"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Word8 -&gt; TensorData Word8
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word16</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-293"></span><span>    </span><span id="local-6989586621679164443"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Word16 -&gt; Vector Word16
</span><a href="#local-6989586621679164443"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData Word16 -&gt; Vector Word16
forall a. Storable a =&gt; TensorData a -&gt; Vector a
</span><a href="TensorFlow.Types.html#simpleDecode"><span class="hs-identifier hs-var">simpleDecode</span></a></span><span>
</span><span id="line-294"></span><span>    </span><span id="local-6989586621679164442"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Word16 -&gt; TensorData Word16
</span><a href="#local-6989586621679164442"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector Word16 -&gt; TensorData Word16
forall a.
(TensorType a, Storable a) =&gt;
Shape -&gt; Vector a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#simpleEncode"><span class="hs-identifier hs-var">simpleEncode</span></a></span><span>
</span><span id="line-295"></span><span>
</span><span id="line-296"></span><span class="hs-comment">-- TODO: Haskell and tensorflow use different byte sizes for bools, which makes</span><span>
</span><span id="line-297"></span><span class="hs-comment">-- encoding more expensive. It may make sense to define a custom boolean type.</span><span>
</span><span id="line-298"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-299"></span><span>    </span><span id="local-6989586621679164438"><span class="annot"><span class="annottext">decodeTensorData :: TensorData Bool -&gt; Vector Bool
</span><a href="#local-6989586621679164438"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-300"></span><span>        </span><span class="annot"><span class="annottext">Vector Bool -&gt; Vector Bool
forall (v :: * -&gt; *) a (w :: * -&gt; *).
(Vector v a, Vector w a) =&gt;
v a -&gt; w a
</span><span class="hs-identifier hs-var">S.convert</span></span><span> </span><span class="annot"><span class="annottext">(Vector Bool -&gt; Vector Bool)
-&gt; (TensorData Bool -&gt; Vector Bool)
-&gt; TensorData Bool
-&gt; Vector Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Bool) -&gt; Vector Word8 -&gt; Vector Bool
forall a b.
(Storable a, Storable b) =&gt;
(a -&gt; b) -&gt; Vector a -&gt; Vector b
</span><span class="hs-identifier hs-var">S.map</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Vector Word8 -&gt; Vector Bool)
-&gt; (TensorData Bool -&gt; Vector Word8)
-&gt; TensorData Bool
-&gt; Vector Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TensorData -&gt; Vector Word8
</span><a href="TensorFlow.Internal.FFI.html#tensorDataBytes"><span class="hs-identifier hs-var hs-var">FFI.tensorDataBytes</span></a></span><span> </span><span class="annot"><span class="annottext">(TensorData -&gt; Vector Word8)
-&gt; (TensorData Bool -&gt; TensorData)
-&gt; TensorData Bool
-&gt; Vector Word8
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TensorData Bool -&gt; TensorData
forall a. TensorData a -&gt; TensorData
</span><a href="TensorFlow.Types.html#unTensorData"><span class="hs-identifier hs-var hs-var">unTensorData</span></a></span><span>
</span><span id="line-301"></span><span>    </span><span id="local-6989586621679164435"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector Bool -&gt; TensorData Bool
</span><a href="#local-6989586621679164435"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span id="local-6989586621679164434"><span class="annot"><span class="annottext">xs :: [Int64]
</span><a href="#local-6989586621679164434"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-302"></span><span>        </span><span class="annot"><span class="annottext">TensorData -&gt; TensorData Bool
forall a. TensorData -&gt; TensorData a
</span><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-var">TensorData</span></a></span><span> </span><span class="annot"><span class="annottext">(TensorData -&gt; TensorData Bool)
-&gt; (Vector Bool -&gt; TensorData) -&gt; Vector Bool -&gt; TensorData Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; DataType -&gt; Vector Word8 -&gt; TensorData
</span><a href="TensorFlow.Internal.FFI.html#TensorData"><span class="hs-identifier hs-var">FFI.TensorData</span></a></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164434"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><span class="hs-identifier hs-var">DT_BOOL</span></span><span> </span><span class="annot"><span class="annottext">(Vector Word8 -&gt; TensorData)
-&gt; (Vector Bool -&gt; Vector Word8) -&gt; Vector Bool -&gt; TensorData
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Word8) -&gt; Vector Bool -&gt; Vector Word8
forall a b.
(Storable a, Storable b) =&gt;
(a -&gt; b) -&gt; Vector a -&gt; Vector b
</span><span class="hs-identifier hs-var">S.map</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Word8
</span><a href="#local-6989586621679164433"><span class="hs-identifier hs-var">fromBool</span></a></span><span> </span><span class="annot"><span class="annottext">(Vector Bool -&gt; Vector Word8)
-&gt; (Vector Bool -&gt; Vector Bool) -&gt; Vector Bool -&gt; Vector Word8
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Vector Bool -&gt; Vector Bool
forall (v :: * -&gt; *) a (w :: * -&gt; *).
(Vector v a, Vector w a) =&gt;
v a -&gt; w a
</span><span class="hs-identifier hs-var">S.convert</span></span><span>
</span><span id="line-303"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-304"></span><span>        </span><span id="local-6989586621679164433"><span class="annot"><span class="annottext">fromBool :: Bool -&gt; Word8
</span><a href="#local-6989586621679164433"><span class="hs-identifier hs-var hs-var">fromBool</span></a></span></span><span> </span><span id="local-6989586621679164432"><span class="annot"><span class="annottext">x :: Bool
</span><a href="#local-6989586621679164432"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679164432"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="hs-number">1</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word8</span></span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span id="local-6989586621679164431"><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPABLE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Storable</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-308"></span><span>    </span><span id="local-6989586621679164427"><span class="annot"><span class="annottext">decodeTensorData :: TensorData a -&gt; Vector a
</span><a href="#local-6989586621679164427"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector a -&gt; Vector a
forall (v :: * -&gt; *) a (w :: * -&gt; *).
(Vector v a, Vector w a) =&gt;
v a -&gt; w a
</span><span class="hs-identifier hs-var">S.convert</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Vector a -&gt; Vector a)
-&gt; (TensorData a -&gt; Vector a) -&gt; TensorData a -&gt; Vector a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TensorData a -&gt; Vector a
forall (s :: * -&gt; *) a. TensorDataType s a =&gt; TensorData a -&gt; s a
</span><a href="TensorFlow.Types.html#decodeTensorData"><span class="hs-identifier hs-var">decodeTensorData</span></a></span><span>
</span><span id="line-309"></span><span>    </span><span id="local-6989586621679164426"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector a -&gt; TensorData a
</span><a href="#local-6989586621679164426"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span id="local-6989586621679164425"><span class="annot"><span class="annottext">x :: Shape
</span><a href="#local-6989586621679164425"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector a -&gt; TensorData a
forall (s :: * -&gt; *) a.
TensorDataType s a =&gt;
Shape -&gt; s a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#encodeTensorData"><span class="hs-identifier hs-var">encodeTensorData</span></a></span><span> </span><span class="annot"><span class="annottext">Shape
</span><a href="#local-6989586621679164425"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">(Vector a -&gt; TensorData a)
-&gt; (Vector a -&gt; Vector a) -&gt; Vector a -&gt; TensorData a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector a -&gt; Vector a
forall (v :: * -&gt; *) a (w :: * -&gt; *).
(Vector v a, Vector w a) =&gt;
v a -&gt; w a
</span><span class="hs-identifier hs-var">S.convert</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164431"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPING</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-312"></span><span>    </span><span id="local-6989586621679164421"><span class="annot"><span class="annottext">decodeTensorData :: TensorData (Complex Float) -&gt; Vector (Complex Float)
</span><a href="#local-6989586621679164421"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; TensorData (Complex Float) -&gt; Vector (Complex Float)
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO (Complex Float)&quot;</span></span><span>
</span><span id="line-313"></span><span>    </span><span id="local-6989586621679164420"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector (Complex Float) -&gt; TensorData (Complex Float)
</span><a href="#local-6989586621679164420"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
-&gt; Shape -&gt; Vector (Complex Float) -&gt; TensorData (Complex Float)
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO (Complex Float)&quot;</span></span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPING</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-316"></span><span>    </span><span id="local-6989586621679164416"><span class="annot"><span class="annottext">decodeTensorData :: TensorData (Complex Double) -&gt; Vector (Complex Double)
</span><a href="#local-6989586621679164416"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; TensorData (Complex Double) -&gt; Vector (Complex Double)
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO (Complex Double)&quot;</span></span><span>
</span><span id="line-317"></span><span>    </span><span id="local-6989586621679164415"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector (Complex Double) -&gt; TensorData (Complex Double)
</span><a href="#local-6989586621679164415"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char]
-&gt; Shape -&gt; Vector (Complex Double) -&gt; TensorData (Complex Double)
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;TODO (Complex Double)&quot;</span></span><span>
</span><span id="line-318"></span><span>
</span><span id="line-319"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-pragma">{-# OVERLAPPING</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-320"></span><span>    </span><span class="hs-comment">-- Encoded data layout (described in third_party/tensorflow/c/c_api.h):</span><span>
</span><span id="line-321"></span><span>    </span><span class="hs-comment">--   table offsets for each element :: [Word64]</span><span>
</span><span id="line-322"></span><span>    </span><span class="hs-comment">--   at each element offset:</span><span>
</span><span id="line-323"></span><span>    </span><span class="hs-comment">--     string length :: VarInt64</span><span>
</span><span id="line-324"></span><span>    </span><span class="hs-comment">--     string data   :: [Word8]</span><span>
</span><span id="line-325"></span><span>    </span><span id="local-6989586621679164411"><span class="annot"><span class="annottext">decodeTensorData :: TensorData ByteString -&gt; Vector ByteString
</span><a href="#local-6989586621679164411"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span id="local-6989586621679164410"><span class="annot"><span class="annottext">tensorData :: TensorData ByteString
</span><a href="#local-6989586621679164410"><span class="hs-identifier hs-var">tensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-326"></span><span>        </span><span class="annot"><span class="annottext">([Char] -&gt; Vector ByteString)
-&gt; (Vector ByteString -&gt; Vector ByteString)
-&gt; Either [Char] (Vector ByteString)
-&gt; Vector ByteString
forall a c b. (a -&gt; c) -&gt; (b -&gt; c) -&gt; Either a b -&gt; c
</span><span class="hs-identifier hs-var">either</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679164408"><span class="annot"><span class="annottext">err :: [Char]
</span><a href="#local-6989586621679164408"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Vector ByteString
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; Vector ByteString) -&gt; [Char] -&gt; Vector ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Malformed TF_STRING tensor; &quot;</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679164408"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Vector ByteString -&gt; Vector ByteString
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span> </span><span class="annot"><span class="annottext">(Either [Char] (Vector ByteString) -&gt; Vector ByteString)
-&gt; Either [Char] (Vector ByteString) -&gt; Vector ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-327"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164406"><span class="hs-identifier hs-var">expected</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164405"><span class="hs-identifier hs-var">count</span></a></span><span>
</span><span id="line-328"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Either [Char] (Vector ByteString)
forall a b. a -&gt; Either a b
</span><span class="hs-identifier hs-var">Left</span></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; Either [Char] (Vector ByteString))
-&gt; [Char] -&gt; Either [Char] (Vector ByteString)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="hs-string">&quot;decodeTensorData for ByteString count mismatch &quot;</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span>
</span><span id="line-329"></span><span>                            </span><span class="annot"><span class="annottext">(Int, Int) -&gt; [Char]
forall a. Show a =&gt; a -&gt; [Char]
</span><span class="hs-identifier hs-var">show</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164406"><span class="hs-identifier hs-var">expected</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164405"><span class="hs-identifier hs-var">count</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(Word64 -&gt; Either [Char] ByteString)
-&gt; Vector Word64 -&gt; Either [Char] (Vector ByteString)
forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m b) -&gt; Vector a -&gt; m (Vector b)
</span><span class="hs-identifier hs-var">V.mapM</span></span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; Either [Char] ByteString
</span><a href="#local-6989586621679164403"><span class="hs-identifier hs-var">decodeString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector Word64 -&gt; Vector Word64
forall (v :: * -&gt; *) a (w :: * -&gt; *).
(Vector v a, Vector w a) =&gt;
v a -&gt; w a
</span><span class="hs-identifier hs-var">S.convert</span></span><span> </span><span class="annot"><span class="annottext">Vector Word64
</span><a href="#local-6989586621679164402"><span class="hs-identifier hs-var">offsets</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-331"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-332"></span><span>        </span><span id="local-6989586621679164406"><span class="annot"><span class="annottext">expected :: Int
</span><a href="#local-6989586621679164406"><span class="hs-identifier hs-var hs-var">expected</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Vector Word64 -&gt; Int
forall a. Storable a =&gt; Vector a -&gt; Int
</span><span class="hs-identifier hs-var">S.length</span></span><span> </span><span class="annot"><span class="annottext">Vector Word64
</span><a href="#local-6989586621679164402"><span class="hs-identifier hs-var">offsets</span></a></span><span>
</span><span id="line-333"></span><span>        </span><span id="local-6989586621679164405"><span class="annot"><span class="annottext">count :: Int
</span><a href="#local-6989586621679164405"><span class="hs-identifier hs-var hs-var">count</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; Int) -&gt; Int64 -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; Int64
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><span class="hs-identifier hs-var">product</span></span><span> </span><span class="annot"><span class="annottext">([Int64] -&gt; Int64) -&gt; [Int64] -&gt; Int64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">TensorData -&gt; [Int64]
</span><a href="TensorFlow.Internal.FFI.html#tensorDataDimensions"><span class="hs-identifier hs-var hs-var">FFI.tensorDataDimensions</span></a></span><span>
</span><span id="line-334"></span><span>                    </span><span class="annot"><span class="annottext">(TensorData -&gt; [Int64]) -&gt; TensorData -&gt; [Int64]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">TensorData ByteString -&gt; TensorData
forall a. TensorData a -&gt; TensorData
</span><a href="TensorFlow.Types.html#unTensorData"><span class="hs-identifier hs-var hs-var">unTensorData</span></a></span><span> </span><span class="annot"><span class="annottext">TensorData ByteString
</span><a href="#local-6989586621679164410"><span class="hs-identifier hs-var">tensorData</span></a></span><span>
</span><span id="line-335"></span><span>        </span><span id="local-6989586621679164400"><span class="annot"><span class="annottext">bytes :: Vector Word8
</span><a href="#local-6989586621679164400"><span class="hs-identifier hs-var hs-var">bytes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorData -&gt; Vector Word8
</span><a href="TensorFlow.Internal.FFI.html#tensorDataBytes"><span class="hs-identifier hs-var hs-var">FFI.tensorDataBytes</span></a></span><span> </span><span class="annot"><span class="annottext">(TensorData -&gt; Vector Word8) -&gt; TensorData -&gt; Vector Word8
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">TensorData ByteString -&gt; TensorData
forall a. TensorData a -&gt; TensorData
</span><a href="TensorFlow.Types.html#unTensorData"><span class="hs-identifier hs-var hs-var">unTensorData</span></a></span><span> </span><span class="annot"><span class="annottext">TensorData ByteString
</span><a href="#local-6989586621679164410"><span class="hs-identifier hs-var">tensorData</span></a></span><span>
</span><span id="line-336"></span><span>        </span><span id="local-6989586621679164402"><span class="annot"><span class="annottext">offsets :: Vector Word64
</span><a href="#local-6989586621679164402"><span class="hs-identifier hs-var hs-var">offsets</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Vector Word64 -&gt; Vector Word64
forall a. Storable a =&gt; Int -&gt; Vector a -&gt; Vector a
</span><span class="hs-identifier hs-var">S.take</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164405"><span class="hs-identifier hs-var">count</span></a></span><span> </span><span class="annot"><span class="annottext">(Vector Word64 -&gt; Vector Word64) -&gt; Vector Word64 -&gt; Vector Word64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Vector Word8 -&gt; Vector Word64
forall a b. (Storable a, Storable b) =&gt; Vector a -&gt; Vector b
</span><span class="hs-identifier hs-var">S.unsafeCast</span></span><span> </span><span class="annot"><span class="annottext">Vector Word8
</span><a href="#local-6989586621679164400"><span class="hs-identifier hs-var">bytes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">S.Vector</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word64</span></span><span>
</span><span id="line-337"></span><span>        </span><span id="local-6989586621679164398"><span class="annot"><span class="annottext">dataBytes :: ByteString
</span><a href="#local-6989586621679164398"><span class="hs-identifier hs-var hs-var">dataBytes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; ByteString
</span><span class="hs-identifier hs-var">B.pack</span></span><span> </span><span class="annot"><span class="annottext">([Word8] -&gt; ByteString) -&gt; [Word8] -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Vector Word8 -&gt; [Word8]
forall a. Storable a =&gt; Vector a -&gt; [a]
</span><span class="hs-identifier hs-var">S.toList</span></span><span> </span><span class="annot"><span class="annottext">(Vector Word8 -&gt; [Word8]) -&gt; Vector Word8 -&gt; [Word8]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Vector Word8 -&gt; Vector Word8
forall a. Storable a =&gt; Int -&gt; Vector a -&gt; Vector a
</span><span class="hs-identifier hs-var">S.drop</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164405"><span class="hs-identifier hs-var">count</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">*</span></span><span> </span><span class="annot"><span class="hs-number">8</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Vector Word8
</span><a href="#local-6989586621679164400"><span class="hs-identifier hs-var">bytes</span></a></span><span>
</span><span id="line-338"></span><span>        </span><span class="annot"><a href="#local-6989586621679164403"><span class="hs-identifier hs-type">decodeString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word64</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Either</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">String</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>
</span><span id="line-339"></span><span>        </span><span id="local-6989586621679164403"><span class="annot"><span class="annottext">decodeString :: Word64 -&gt; Either [Char] ByteString
</span><a href="#local-6989586621679164403"><span class="hs-identifier hs-var hs-var">decodeString</span></a></span></span><span> </span><span id="local-6989586621679164392"><span class="annot"><span class="annottext">offset :: Word64
</span><a href="#local-6989586621679164392"><span class="hs-identifier hs-var">offset</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-340"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679164391"><span class="annot"><span class="annottext">stringDataStart :: ByteString
</span><a href="#local-6989586621679164391"><span class="hs-identifier hs-var hs-var">stringDataStart</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ByteString -&gt; ByteString
</span><span class="hs-identifier hs-var">B.drop</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679164392"><span class="hs-identifier hs-var">offset</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679164398"><span class="hs-identifier hs-var">dataBytes</span></a></span><span>
</span><span id="line-341"></span><span>            </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Result ByteString -&gt; Either [Char] ByteString
forall r. Result r -&gt; Either [Char] r
</span><span class="hs-identifier hs-var">Atto.eitherResult</span></span><span> </span><span class="annot"><span class="annottext">(Result ByteString -&gt; Either [Char] ByteString)
-&gt; Result ByteString -&gt; Either [Char] ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Parser ByteString -&gt; ByteString -&gt; Result ByteString
forall a. Parser a -&gt; ByteString -&gt; Result a
</span><span class="hs-identifier hs-var">Atto.parse</span></span><span> </span><span class="annot"><span class="annottext">Parser ByteString
</span><a href="#local-6989586621679164387"><span class="hs-identifier hs-var">stringParser</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679164391"><span class="hs-identifier hs-var">stringDataStart</span></a></span><span>
</span><span id="line-342"></span><span>        </span><span class="annot"><a href="#local-6989586621679164387"><span class="hs-identifier hs-type">stringParser</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Atto.Parser</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>
</span><span id="line-343"></span><span>        </span><span id="local-6989586621679164387"><span class="annot"><span class="annottext">stringParser :: Parser ByteString
</span><a href="#local-6989586621679164387"><span class="hs-identifier hs-var hs-var">stringParser</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Parser Word64
</span><a href="TensorFlow.Internal.VarInt.html#getVarInt"><span class="hs-identifier hs-var">getVarInt</span></a></span><span> </span><span class="annot"><span class="annottext">Parser Word64 -&gt; (Word64 -&gt; Parser ByteString) -&gt; Parser ByteString
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><span class="hs-operator hs-var">&gt;&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Parser ByteString
</span><span class="hs-identifier hs-var">Atto.take</span></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Parser ByteString)
-&gt; (Word64 -&gt; Int) -&gt; Word64 -&gt; Parser ByteString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span>
</span><span id="line-344"></span><span>    </span><span id="local-6989586621679164385"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Vector ByteString -&gt; TensorData ByteString
</span><a href="#local-6989586621679164385"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span id="local-6989586621679164384"><span class="annot"><span class="annottext">xs :: [Int64]
</span><a href="#local-6989586621679164384"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164383"><span class="annot"><span class="annottext">vec :: Vector ByteString
</span><a href="#local-6989586621679164383"><span class="hs-identifier hs-var">vec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-345"></span><span>        </span><span class="annot"><span class="annottext">TensorData -&gt; TensorData ByteString
forall a. TensorData -&gt; TensorData a
</span><a href="TensorFlow.Types.html#TensorData"><span class="hs-identifier hs-var">TensorData</span></a></span><span> </span><span class="annot"><span class="annottext">(TensorData -&gt; TensorData ByteString)
-&gt; TensorData -&gt; TensorData ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; DataType -&gt; Vector Word8 -&gt; TensorData
</span><a href="TensorFlow.Internal.FFI.html#TensorData"><span class="hs-identifier hs-var">FFI.TensorData</span></a></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164384"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="#local-6989586621679164382"><span class="hs-identifier hs-var">dt</span></a></span><span> </span><span class="annot"><span class="annottext">Vector Word8
</span><a href="#local-6989586621679164381"><span class="hs-identifier hs-var">byteVector</span></a></span><span>
</span><span id="line-346"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-347"></span><span>        </span><span id="local-6989586621679164382"><span class="annot"><span class="annottext">dt :: DataType
</span><a href="#local-6989586621679164382"><span class="hs-identifier hs-var hs-var">dt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><a href="TensorFlow.Types.html#tensorType"><span class="hs-identifier hs-var">tensorType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span class="hs-special">)</span><span>
</span><span id="line-348"></span><span>        </span><span class="hs-comment">-- Add a string to an offset table and data blob.</span><span>
</span><span id="line-349"></span><span>        </span><span class="annot"><a href="#local-6989586621679164380"><span class="hs-identifier hs-type">addString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Builder</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Builder</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word64</span></span><span class="hs-special">)</span><span>
</span><span id="line-350"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>
</span><span id="line-351"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Builder</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Builder</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word64</span></span><span class="hs-special">)</span><span>
</span><span id="line-352"></span><span>        </span><span id="local-6989586621679164380"><span class="annot"><span class="annottext">addString :: (Builder, Builder, Word64)
-&gt; ByteString -&gt; (Builder, Builder, Word64)
</span><a href="#local-6989586621679164380"><span class="hs-identifier hs-var hs-var">addString</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164379"><span class="annot"><span class="annottext">table :: Builder
</span><a href="#local-6989586621679164379"><span class="hs-identifier hs-var">table</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164378"><span class="annot"><span class="annottext">strings :: Builder
</span><a href="#local-6989586621679164378"><span class="hs-identifier hs-var">strings</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164377"><span class="annot"><span class="annottext">offset :: Word64
</span><a href="#local-6989586621679164377"><span class="hs-identifier hs-var">offset</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164376"><span class="annot"><span class="annottext">str :: ByteString
</span><a href="#local-6989586621679164376"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-353"></span><span>            </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164379"><span class="hs-identifier hs-var">table</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; Builder
</span><span class="hs-identifier hs-var">Builder.word64LE</span></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679164377"><span class="hs-identifier hs-var">offset</span></a></span><span>
</span><span id="line-354"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164378"><span class="hs-identifier hs-var">strings</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164374"><span class="hs-identifier hs-var">lengthBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Builder
</span><span class="hs-identifier hs-var">Builder.byteString</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679164376"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-355"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679164377"><span class="hs-identifier hs-var">offset</span></a></span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; Word64 -&gt; Word64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">+</span></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679164371"><span class="hs-identifier hs-var">lengthBytesLen</span></a></span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; Word64 -&gt; Word64
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">+</span></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621679164370"><span class="hs-identifier hs-var">strLen</span></a></span><span>
</span><span id="line-356"></span><span>            </span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-358"></span><span>            </span><span id="local-6989586621679164370"><span class="annot"><span class="annottext">strLen :: Word64
</span><a href="#local-6989586621679164370"><span class="hs-identifier hs-var hs-var">strLen</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Word64) -&gt; Int -&gt; Word64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><span class="hs-identifier hs-var">B.length</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679164376"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-359"></span><span>            </span><span id="local-6989586621679164374"><span class="annot"><span class="annottext">lengthBytes :: Builder
</span><a href="#local-6989586621679164374"><span class="hs-identifier hs-var hs-var">lengthBytes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word64 -&gt; Builder
</span><a href="TensorFlow.Internal.VarInt.html#putVarInt"><span class="hs-identifier hs-var">putVarInt</span></a></span><span> </span><span class="annot"><span class="annottext">(Word64 -&gt; Builder) -&gt; Word64 -&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Word64) -&gt; Int -&gt; Word64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><span class="hs-identifier hs-var">B.length</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679164376"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-360"></span><span>            </span><span id="local-6989586621679164371"><span class="annot"><span class="annottext">lengthBytesLen :: Word64
</span><a href="#local-6989586621679164371"><span class="hs-identifier hs-var hs-var">lengthBytesLen</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-361"></span><span>                </span><span class="annot"><span class="annottext">Int64 -&gt; Word64
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><span class="hs-identifier hs-var">fromIntegral</span></span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; Word64) -&gt; Int64 -&gt; Word64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int64
</span><span class="hs-identifier hs-var">L.length</span></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; Int64) -&gt; ByteString -&gt; Int64
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; ByteString
</span><span class="hs-identifier hs-var">Builder.toLazyByteString</span></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164374"><span class="hs-identifier hs-var">lengthBytes</span></a></span><span>
</span><span id="line-362"></span><span>        </span><span class="hs-comment">-- Encode all strings.</span><span>
</span><span id="line-363"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679164366"><span class="annot"><span class="annottext">table' :: Builder
</span><a href="#local-6989586621679164366"><span class="hs-identifier hs-var">table'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164365"><span class="annot"><span class="annottext">strings' :: Builder
</span><a href="#local-6989586621679164365"><span class="hs-identifier hs-var">strings'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Builder, Builder, Word64)
 -&gt; ByteString -&gt; (Builder, Builder, Word64))
-&gt; (Builder, Builder, Word64)
-&gt; Vector ByteString
-&gt; (Builder, Builder, Word64)
forall a b. (a -&gt; b -&gt; a) -&gt; a -&gt; Vector b -&gt; a
</span><span class="hs-identifier hs-var">V.foldl'</span></span><span> </span><span class="annot"><span class="annottext">(Builder, Builder, Word64)
-&gt; ByteString -&gt; (Builder, Builder, Word64)
</span><a href="#local-6989586621679164380"><span class="hs-identifier hs-var">addString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Builder
forall a. Monoid a =&gt; a
</span><span class="hs-identifier hs-var">mempty</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Builder
forall a. Monoid a =&gt; a
</span><span class="hs-identifier hs-var">mempty</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Vector ByteString
</span><a href="#local-6989586621679164383"><span class="hs-identifier hs-var">vec</span></a></span><span>
</span><span id="line-364"></span><span>        </span><span class="hs-comment">-- Concat offset table with data.</span><span>
</span><span id="line-365"></span><span>        </span><span id="local-6989586621679164363"><span class="annot"><span class="annottext">bytes :: Builder
</span><a href="#local-6989586621679164363"><span class="hs-identifier hs-var hs-var">bytes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164366"><span class="hs-identifier hs-var">table'</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Builder -&gt; Builder
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164365"><span class="hs-identifier hs-var">strings'</span></a></span><span>
</span><span id="line-366"></span><span>        </span><span class="hs-comment">-- Convert to Vector Word8.</span><span>
</span><span id="line-367"></span><span>        </span><span id="local-6989586621679164381"><span class="annot"><span class="annottext">byteVector :: Vector Word8
</span><a href="#local-6989586621679164381"><span class="hs-identifier hs-var hs-var">byteVector</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; Vector Word8
forall a. Storable a =&gt; [a] -&gt; Vector a
</span><span class="hs-identifier hs-var">S.fromList</span></span><span> </span><span class="annot"><span class="annottext">([Word8] -&gt; Vector Word8) -&gt; [Word8] -&gt; Vector Word8
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; [Word8]
</span><span class="hs-identifier hs-var">L.unpack</span></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; [Word8]) -&gt; ByteString -&gt; [Word8]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; ByteString
</span><span class="hs-identifier hs-var">Builder.toLazyByteString</span></span><span> </span><span class="annot"><span class="annottext">Builder
</span><a href="#local-6989586621679164363"><span class="hs-identifier hs-var">bytes</span></a></span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-keyword">newtype</span><span> </span><span id="Scalar"><span class="annot"><a href="TensorFlow.Types.html#Scalar"><span class="hs-identifier hs-var">Scalar</span></a></span></span><span> </span><span id="local-6989586621679164807"><span class="annot"><a href="#local-6989586621679164807"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Scalar"><span class="annot"><a href="TensorFlow.Types.html#Scalar"><span class="hs-identifier hs-var">Scalar</span></a></span></span><span> </span><span class="hs-special">{</span><span id="unScalar"><span class="annot"><span class="annottext">Scalar a -&gt; a
</span><a href="TensorFlow.Types.html#unScalar"><span class="hs-identifier hs-var hs-var">unScalar</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164807"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-370"></span><span>    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164353"><span id="local-6989586621679164355"><span id="local-6989586621679164357"><span class="annot"><span class="annottext">Int -&gt; Scalar a -&gt; [Char] -&gt; [Char]
[Scalar a] -&gt; [Char] -&gt; [Char]
Scalar a -&gt; [Char]
(Int -&gt; Scalar a -&gt; [Char] -&gt; [Char])
-&gt; (Scalar a -&gt; [Char])
-&gt; ([Scalar a] -&gt; [Char] -&gt; [Char])
-&gt; Show (Scalar a)
forall a. Show a =&gt; Int -&gt; Scalar a -&gt; [Char] -&gt; [Char]
forall a. Show a =&gt; [Scalar a] -&gt; [Char] -&gt; [Char]
forall a. Show a =&gt; Scalar a -&gt; [Char]
forall a.
(Int -&gt; a -&gt; [Char] -&gt; [Char])
-&gt; (a -&gt; [Char]) -&gt; ([a] -&gt; [Char] -&gt; [Char]) -&gt; Show a
showList :: [Scalar a] -&gt; [Char] -&gt; [Char]
$cshowList :: forall a. Show a =&gt; [Scalar a] -&gt; [Char] -&gt; [Char]
show :: Scalar a -&gt; [Char]
$cshow :: forall a. Show a =&gt; Scalar a -&gt; [Char]
showsPrec :: Int -&gt; Scalar a -&gt; [Char] -&gt; [Char]
$cshowsPrec :: forall a. Show a =&gt; Int -&gt; Scalar a -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164348"><span id="local-6989586621679164350"><span class="annot"><span class="annottext">Scalar a -&gt; Scalar a -&gt; Bool
(Scalar a -&gt; Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Scalar a -&gt; Bool) -&gt; Eq (Scalar a)
forall a. Eq a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Scalar a -&gt; Scalar a -&gt; Bool
$c/= :: forall a. Eq a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
== :: Scalar a -&gt; Scalar a -&gt; Bool
$c== :: forall a. Eq a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164332"><span id="local-6989586621679164334"><span id="local-6989586621679164336"><span id="local-6989586621679164338"><span id="local-6989586621679164340"><span id="local-6989586621679164342"><span id="local-6989586621679164344"><span class="annot"><span class="annottext">Eq (Scalar a)
Eq (Scalar a) =&gt;
(Scalar a -&gt; Scalar a -&gt; Ordering)
-&gt; (Scalar a -&gt; Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; Ord (Scalar a)
Scalar a -&gt; Scalar a -&gt; Bool
Scalar a -&gt; Scalar a -&gt; Ordering
Scalar a -&gt; Scalar a -&gt; Scalar a
forall a.
Eq a =&gt;
(a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
forall a. Ord a =&gt; Eq (Scalar a)
forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Ordering
forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
min :: Scalar a -&gt; Scalar a -&gt; Scalar a
$cmin :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
max :: Scalar a -&gt; Scalar a -&gt; Scalar a
$cmax :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
&gt;= :: Scalar a -&gt; Scalar a -&gt; Bool
$c&gt;= :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
&gt; :: Scalar a -&gt; Scalar a -&gt; Bool
$c&gt; :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
&lt;= :: Scalar a -&gt; Scalar a -&gt; Bool
$c&lt;= :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
&lt; :: Scalar a -&gt; Scalar a -&gt; Bool
$c&lt; :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Bool
compare :: Scalar a -&gt; Scalar a -&gt; Ordering
$ccompare :: forall a. Ord a =&gt; Scalar a -&gt; Scalar a -&gt; Ordering
$cp1Ord :: forall a. Ord a =&gt; Eq (Scalar a)
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164317"><span id="local-6989586621679164319"><span id="local-6989586621679164321"><span id="local-6989586621679164323"><span id="local-6989586621679164325"><span id="local-6989586621679164327"><span id="local-6989586621679164329"><span class="annot"><span class="annottext">Integer -&gt; Scalar a
Scalar a -&gt; Scalar a
Scalar a -&gt; Scalar a -&gt; Scalar a
(Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Integer -&gt; Scalar a)
-&gt; Num (Scalar a)
forall a. Num a =&gt; Integer -&gt; Scalar a
forall a. Num a =&gt; Scalar a -&gt; Scalar a
forall a. Num a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
forall a.
(a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (Integer -&gt; a)
-&gt; Num a
fromInteger :: Integer -&gt; Scalar a
$cfromInteger :: forall a. Num a =&gt; Integer -&gt; Scalar a
signum :: Scalar a -&gt; Scalar a
$csignum :: forall a. Num a =&gt; Scalar a -&gt; Scalar a
abs :: Scalar a -&gt; Scalar a
$cabs :: forall a. Num a =&gt; Scalar a -&gt; Scalar a
negate :: Scalar a -&gt; Scalar a
$cnegate :: forall a. Num a =&gt; Scalar a -&gt; Scalar a
* :: Scalar a -&gt; Scalar a -&gt; Scalar a
$c* :: forall a. Num a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
- :: Scalar a -&gt; Scalar a -&gt; Scalar a
$c- :: forall a. Num a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
+ :: Scalar a -&gt; Scalar a -&gt; Scalar a
$c+ :: forall a. Num a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Num</span></span></span></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164309"><span id="local-6989586621679164311"><span id="local-6989586621679164313"><span class="annot"><span class="annottext">Num (Scalar a)
Num (Scalar a) =&gt;
(Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Rational -&gt; Scalar a)
-&gt; Fractional (Scalar a)
Rational -&gt; Scalar a
Scalar a -&gt; Scalar a
Scalar a -&gt; Scalar a -&gt; Scalar a
forall a. Fractional a =&gt; Num (Scalar a)
forall a. Fractional a =&gt; Rational -&gt; Scalar a
forall a. Fractional a =&gt; Scalar a -&gt; Scalar a
forall a. Fractional a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
forall a.
Num a =&gt;
(a -&gt; a -&gt; a) -&gt; (a -&gt; a) -&gt; (Rational -&gt; a) -&gt; Fractional a
fromRational :: Rational -&gt; Scalar a
$cfromRational :: forall a. Fractional a =&gt; Rational -&gt; Scalar a
recip :: Scalar a -&gt; Scalar a
$crecip :: forall a. Fractional a =&gt; Scalar a -&gt; Scalar a
/ :: Scalar a -&gt; Scalar a -&gt; Scalar a
$c/ :: forall a. Fractional a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
$cp1Fractional :: forall a. Fractional a =&gt; Num (Scalar a)
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Fractional</span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164263"><span id="local-6989586621679164265"><span id="local-6989586621679164267"><span id="local-6989586621679164269"><span id="local-6989586621679164271"><span id="local-6989586621679164273"><span id="local-6989586621679164275"><span id="local-6989586621679164277"><span id="local-6989586621679164279"><span id="local-6989586621679164281"><span id="local-6989586621679164283"><span id="local-6989586621679164285"><span id="local-6989586621679164287"><span id="local-6989586621679164289"><span id="local-6989586621679164291"><span id="local-6989586621679164293"><span id="local-6989586621679164295"><span id="local-6989586621679164297"><span id="local-6989586621679164299"><span id="local-6989586621679164301"><span id="local-6989586621679164303"><span id="local-6989586621679164305"><span class="annot"><span class="annottext">Fractional (Scalar a)
Scalar a
Fractional (Scalar a) =&gt;
Scalar a
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; Floating (Scalar a)
Scalar a -&gt; Scalar a
Scalar a -&gt; Scalar a -&gt; Scalar a
forall a. Floating a =&gt; Fractional (Scalar a)
forall a. Floating a =&gt; Scalar a
forall a. Floating a =&gt; Scalar a -&gt; Scalar a
forall a. Floating a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
forall a.
Fractional a =&gt;
a
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; (a -&gt; a)
-&gt; Floating a
log1mexp :: Scalar a -&gt; Scalar a
$clog1mexp :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
log1pexp :: Scalar a -&gt; Scalar a
$clog1pexp :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
expm1 :: Scalar a -&gt; Scalar a
$cexpm1 :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
log1p :: Scalar a -&gt; Scalar a
$clog1p :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
atanh :: Scalar a -&gt; Scalar a
$catanh :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
acosh :: Scalar a -&gt; Scalar a
$cacosh :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
asinh :: Scalar a -&gt; Scalar a
$casinh :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
tanh :: Scalar a -&gt; Scalar a
$ctanh :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
cosh :: Scalar a -&gt; Scalar a
$ccosh :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
sinh :: Scalar a -&gt; Scalar a
$csinh :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
atan :: Scalar a -&gt; Scalar a
$catan :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
acos :: Scalar a -&gt; Scalar a
$cacos :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
asin :: Scalar a -&gt; Scalar a
$casin :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
tan :: Scalar a -&gt; Scalar a
$ctan :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
cos :: Scalar a -&gt; Scalar a
$ccos :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
sin :: Scalar a -&gt; Scalar a
$csin :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
logBase :: Scalar a -&gt; Scalar a -&gt; Scalar a
$clogBase :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
** :: Scalar a -&gt; Scalar a -&gt; Scalar a
$c** :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
sqrt :: Scalar a -&gt; Scalar a
$csqrt :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
log :: Scalar a -&gt; Scalar a
$clog :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
exp :: Scalar a -&gt; Scalar a
$cexp :: forall a. Floating a =&gt; Scalar a -&gt; Scalar a
pi :: Scalar a
$cpi :: forall a. Floating a =&gt; Scalar a
$cp1Floating :: forall a. Floating a =&gt; Fractional (Scalar a)
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Floating</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164258"><span class="annot"><span class="annottext">Num (Scalar a)
Ord (Scalar a)
(Num (Scalar a), Ord (Scalar a)) =&gt;
(Scalar a -&gt; Rational) -&gt; Real (Scalar a)
Scalar a -&gt; Rational
forall a. (Num a, Ord a) =&gt; (a -&gt; Rational) -&gt; Real a
forall a. Real a =&gt; Num (Scalar a)
forall a. Real a =&gt; Ord (Scalar a)
forall a. Real a =&gt; Scalar a -&gt; Rational
toRational :: Scalar a -&gt; Rational
$ctoRational :: forall a. Real a =&gt; Scalar a -&gt; Rational
$cp2Real :: forall a. Real a =&gt; Ord (Scalar a)
$cp1Real :: forall a. Real a =&gt; Num (Scalar a)
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Real</span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164227"><span id="local-6989586621679164229"><span id="local-6989586621679164231"><span id="local-6989586621679164233"><span id="local-6989586621679164235"><span id="local-6989586621679164237"><span id="local-6989586621679164239"><span id="local-6989586621679164241"><span id="local-6989586621679164243"><span id="local-6989586621679164245"><span id="local-6989586621679164247"><span id="local-6989586621679164249"><span id="local-6989586621679164251"><span id="local-6989586621679164253"><span class="annot"><span class="annottext">Floating (Scalar a)
RealFrac (Scalar a)
(RealFrac (Scalar a), Floating (Scalar a)) =&gt;
(Scalar a -&gt; Integer)
-&gt; (Scalar a -&gt; Int)
-&gt; (Scalar a -&gt; (Int, Int))
-&gt; (Scalar a -&gt; (Integer, Int))
-&gt; (Integer -&gt; Int -&gt; Scalar a)
-&gt; (Scalar a -&gt; Int)
-&gt; (Scalar a -&gt; Scalar a)
-&gt; (Int -&gt; Scalar a -&gt; Scalar a)
-&gt; (Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Bool)
-&gt; (Scalar a -&gt; Scalar a -&gt; Scalar a)
-&gt; RealFloat (Scalar a)
Int -&gt; Scalar a -&gt; Scalar a
Integer -&gt; Int -&gt; Scalar a
Scalar a -&gt; Bool
Scalar a -&gt; Int
Scalar a -&gt; Integer
Scalar a -&gt; (Int, Int)
Scalar a -&gt; (Integer, Int)
Scalar a -&gt; Scalar a
Scalar a -&gt; Scalar a -&gt; Scalar a
forall a. RealFloat a =&gt; Floating (Scalar a)
forall a. RealFloat a =&gt; RealFrac (Scalar a)
forall a. RealFloat a =&gt; Int -&gt; Scalar a -&gt; Scalar a
forall a. RealFloat a =&gt; Integer -&gt; Int -&gt; Scalar a
forall a. RealFloat a =&gt; Scalar a -&gt; Bool
forall a. RealFloat a =&gt; Scalar a -&gt; Int
forall a. RealFloat a =&gt; Scalar a -&gt; Integer
forall a. RealFloat a =&gt; Scalar a -&gt; (Int, Int)
forall a. RealFloat a =&gt; Scalar a -&gt; (Integer, Int)
forall a. RealFloat a =&gt; Scalar a -&gt; Scalar a
forall a. RealFloat a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
forall a.
(RealFrac a, Floating a) =&gt;
(a -&gt; Integer)
-&gt; (a -&gt; Int)
-&gt; (a -&gt; (Int, Int))
-&gt; (a -&gt; (Integer, Int))
-&gt; (Integer -&gt; Int -&gt; a)
-&gt; (a -&gt; Int)
-&gt; (a -&gt; a)
-&gt; (Int -&gt; a -&gt; a)
-&gt; (a -&gt; Bool)
-&gt; (a -&gt; Bool)
-&gt; (a -&gt; Bool)
-&gt; (a -&gt; Bool)
-&gt; (a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; RealFloat a
atan2 :: Scalar a -&gt; Scalar a -&gt; Scalar a
$catan2 :: forall a. RealFloat a =&gt; Scalar a -&gt; Scalar a -&gt; Scalar a
isIEEE :: Scalar a -&gt; Bool
$cisIEEE :: forall a. RealFloat a =&gt; Scalar a -&gt; Bool
isNegativeZero :: Scalar a -&gt; Bool
$cisNegativeZero :: forall a. RealFloat a =&gt; Scalar a -&gt; Bool
isDenormalized :: Scalar a -&gt; Bool
$cisDenormalized :: forall a. RealFloat a =&gt; Scalar a -&gt; Bool
isInfinite :: Scalar a -&gt; Bool
$cisInfinite :: forall a. RealFloat a =&gt; Scalar a -&gt; Bool
isNaN :: Scalar a -&gt; Bool
$cisNaN :: forall a. RealFloat a =&gt; Scalar a -&gt; Bool
scaleFloat :: Int -&gt; Scalar a -&gt; Scalar a
$cscaleFloat :: forall a. RealFloat a =&gt; Int -&gt; Scalar a -&gt; Scalar a
significand :: Scalar a -&gt; Scalar a
$csignificand :: forall a. RealFloat a =&gt; Scalar a -&gt; Scalar a
exponent :: Scalar a -&gt; Int
$cexponent :: forall a. RealFloat a =&gt; Scalar a -&gt; Int
encodeFloat :: Integer -&gt; Int -&gt; Scalar a
$cencodeFloat :: forall a. RealFloat a =&gt; Integer -&gt; Int -&gt; Scalar a
decodeFloat :: Scalar a -&gt; (Integer, Int)
$cdecodeFloat :: forall a. RealFloat a =&gt; Scalar a -&gt; (Integer, Int)
floatRange :: Scalar a -&gt; (Int, Int)
$cfloatRange :: forall a. RealFloat a =&gt; Scalar a -&gt; (Int, Int)
floatDigits :: Scalar a -&gt; Int
$cfloatDigits :: forall a. RealFloat a =&gt; Scalar a -&gt; Int
floatRadix :: Scalar a -&gt; Integer
$cfloatRadix :: forall a. RealFloat a =&gt; Scalar a -&gt; Integer
$cp2RealFloat :: forall a. RealFloat a =&gt; Floating (Scalar a)
$cp1RealFloat :: forall a. RealFloat a =&gt; RealFrac (Scalar a)
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">RealFloat</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hs-special">,</span><span>
</span><span id="line-371"></span><span>              </span><span id="local-6989586621679164214"><span id="local-6989586621679164216"><span id="local-6989586621679164218"><span id="local-6989586621679164220"><span id="local-6989586621679164222"><span class="annot"><span class="annottext">Fractional (Scalar a)
Real (Scalar a)
(Real (Scalar a), Fractional (Scalar a)) =&gt;
(forall b. Integral b =&gt; Scalar a -&gt; (b, Scalar a))
-&gt; (forall b. Integral b =&gt; Scalar a -&gt; b)
-&gt; (forall b. Integral b =&gt; Scalar a -&gt; b)
-&gt; (forall b. Integral b =&gt; Scalar a -&gt; b)
-&gt; (forall b. Integral b =&gt; Scalar a -&gt; b)
-&gt; RealFrac (Scalar a)
Scalar a -&gt; b
Scalar a -&gt; b
Scalar a -&gt; b
Scalar a -&gt; b
Scalar a -&gt; (b, Scalar a)
forall b. Integral b =&gt; Scalar a -&gt; b
forall b. Integral b =&gt; Scalar a -&gt; (b, Scalar a)
forall a.
(Real a, Fractional a) =&gt;
(forall b. Integral b =&gt; a -&gt; (b, a))
-&gt; (forall b. Integral b =&gt; a -&gt; b)
-&gt; (forall b. Integral b =&gt; a -&gt; b)
-&gt; (forall b. Integral b =&gt; a -&gt; b)
-&gt; (forall b. Integral b =&gt; a -&gt; b)
-&gt; RealFrac a
forall a. RealFrac a =&gt; Fractional (Scalar a)
forall a. RealFrac a =&gt; Real (Scalar a)
forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; b
forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; (b, Scalar a)
floor :: Scalar a -&gt; b
$cfloor :: forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; b
ceiling :: Scalar a -&gt; b
$cceiling :: forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; b
round :: Scalar a -&gt; b
$cround :: forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; b
truncate :: Scalar a -&gt; b
$ctruncate :: forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; b
properFraction :: Scalar a -&gt; (b, Scalar a)
$cproperFraction :: forall a b. (RealFrac a, Integral b) =&gt; Scalar a -&gt; (b, Scalar a)
$cp2RealFrac :: forall a. RealFrac a =&gt; Fractional (Scalar a)
$cp1RealFrac :: forall a. RealFrac a =&gt; Real (Scalar a)
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">RealFrac</span></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679164211"><span class="annot"><span class="annottext">[Char] -&gt; Scalar a
([Char] -&gt; Scalar a) -&gt; IsString (Scalar a)
forall a. IsString a =&gt; [Char] -&gt; Scalar a
forall a. ([Char] -&gt; a) -&gt; IsString a
fromString :: [Char] -&gt; Scalar a
$cfromString :: forall a. IsString a =&gt; [Char] -&gt; Scalar a
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">IsString</span></span></span><span class="hs-special">)</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span id="local-6989586621679164209"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164209"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164209"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorDataType"><span class="hs-identifier hs-type">TensorDataType</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Scalar"><span class="hs-identifier hs-type">Scalar</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164209"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-374"></span><span>    </span><span id="local-6989586621679164205"><span class="annot"><span class="annottext">decodeTensorData :: TensorData a -&gt; Scalar a
</span><a href="#local-6989586621679164205"><span class="hs-identifier hs-var hs-var hs-var hs-var">decodeTensorData</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Scalar a
forall a. a -&gt; Scalar a
</span><a href="TensorFlow.Types.html#Scalar"><span class="hs-identifier hs-var">Scalar</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Scalar a) -&gt; (TensorData a -&gt; a) -&gt; TensorData a -&gt; Scalar a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Vector a -&gt; a
forall a. Vector a -&gt; a
</span><a href="TensorFlow.Types.html#headFromSingleton"><span class="hs-identifier hs-var">headFromSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">(Vector a -&gt; a) -&gt; (TensorData a -&gt; Vector a) -&gt; TensorData a -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TensorData a -&gt; Vector a
forall (s :: * -&gt; *) a. TensorDataType s a =&gt; TensorData a -&gt; s a
</span><a href="TensorFlow.Types.html#decodeTensorData"><span class="hs-identifier hs-var">decodeTensorData</span></a></span><span>
</span><span id="line-375"></span><span>    </span><span id="local-6989586621679164203"><span class="annot"><span class="annottext">encodeTensorData :: Shape -&gt; Scalar a -&gt; TensorData a
</span><a href="#local-6989586621679164203"><span class="hs-identifier hs-var hs-var hs-var hs-var">encodeTensorData</span></a></span></span><span> </span><span id="local-6989586621679164202"><span class="annot"><span class="annottext">x :: Shape
</span><a href="#local-6989586621679164202"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Scalar"><span class="hs-identifier hs-type">Scalar</span></a></span><span> </span><span id="local-6989586621679164201"><span class="annot"><span class="annottext">y :: a
</span><a href="#local-6989586621679164201"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Vector a -&gt; TensorData a
forall (s :: * -&gt; *) a.
TensorDataType s a =&gt;
Shape -&gt; s a -&gt; TensorData a
</span><a href="TensorFlow.Types.html#encodeTensorData"><span class="hs-identifier hs-var">encodeTensorData</span></a></span><span> </span><span class="annot"><span class="annottext">Shape
</span><a href="#local-6989586621679164202"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; Vector a
forall a. [a] -&gt; Vector a
</span><span class="hs-identifier hs-var">V.fromList</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679164201"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-376"></span><span>
</span><span id="line-377"></span><span id="local-6989586621679164806"><span class="annot"><a href="TensorFlow.Types.html#headFromSingleton"><span class="hs-identifier hs-type">headFromSingleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">V.Vector</span></span><span> </span><span class="annot"><a href="#local-6989586621679164806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679164806"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-378"></span><span id="headFromSingleton"><span class="annot"><span class="annottext">headFromSingleton :: Vector a -&gt; a
</span><a href="TensorFlow.Types.html#headFromSingleton"><span class="hs-identifier hs-var hs-var">headFromSingleton</span></a></span></span><span> </span><span id="local-6989586621679164199"><span class="annot"><span class="annottext">x :: Vector a
</span><a href="#local-6989586621679164199"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-379"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Vector a -&gt; Int
forall a. Vector a -&gt; Int
</span><span class="hs-identifier hs-var">V.length</span></span><span> </span><span class="annot"><span class="annottext">Vector a
</span><a href="#local-6989586621679164199"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Vector a -&gt; a
forall a. Vector a -&gt; a
</span><span class="hs-identifier hs-var">V.head</span></span><span> </span><span class="annot"><span class="annottext">Vector a
</span><a href="#local-6989586621679164199"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-380"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; a) -&gt; [Char] -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-381"></span><span>                  </span><span class="annot"><span class="hs-string">&quot;Unable to extract singleton from tensor of length &quot;</span></span><span>
</span><span id="line-382"></span><span>                  </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Char]
forall a. Show a =&gt; a -&gt; [Char]
</span><span class="hs-identifier hs-var">show</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Vector a -&gt; Int
forall a. Vector a -&gt; Int
</span><span class="hs-identifier hs-var">V.length</span></span><span> </span><span class="annot"><span class="annottext">Vector a
</span><a href="#local-6989586621679164199"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span>
</span><span id="line-385"></span><span class="hs-comment">-- | Shape (dimensions) of a tensor.</span><span>
</span><span id="line-386"></span><span class="hs-comment">--</span><span>
</span><span id="line-387"></span><span class="hs-comment">-- TensorFlow supports shapes of unknown rank, which are represented as</span><span>
</span><span id="line-388"></span><span class="hs-comment">-- @Nothing :: Maybe Shape@ in Haskell.</span><span>
</span><span id="line-389"></span><span class="hs-keyword">newtype</span><span> </span><span id="Shape"><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-var">Shape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Shape"><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-var">Shape</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span class="hs-special">]</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span id="local-6989586621679164191"><span id="local-6989586621679164193"><span id="local-6989586621679164195"><span class="annot"><span class="annottext">Int -&gt; Shape -&gt; [Char] -&gt; [Char]
[Shape] -&gt; [Char] -&gt; [Char]
Shape -&gt; [Char]
(Int -&gt; Shape -&gt; [Char] -&gt; [Char])
-&gt; (Shape -&gt; [Char]) -&gt; ([Shape] -&gt; [Char] -&gt; [Char]) -&gt; Show Shape
forall a.
(Int -&gt; a -&gt; [Char] -&gt; [Char])
-&gt; (a -&gt; [Char]) -&gt; ([a] -&gt; [Char] -&gt; [Char]) -&gt; Show a
showList :: [Shape] -&gt; [Char] -&gt; [Char]
$cshowList :: [Shape] -&gt; [Char] -&gt; [Char]
show :: Shape -&gt; [Char]
$cshow :: Shape -&gt; [Char]
showsPrec :: Int -&gt; Shape -&gt; [Char] -&gt; [Char]
$cshowsPrec :: Int -&gt; Shape -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></span></span></span></span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679164188"><span class="annot"><span class="hs-identifier hs-type">IsList</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-392"></span><span>    </span><span class="hs-keyword">type</span><span> </span><span id="Item"><span class="annot"><span class="hs-identifier hs-var">Item</span></span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>
</span><span id="line-393"></span><span>    </span><span id="local-6989586621679164185"><span class="annot"><span class="annottext">fromList :: [Item Shape] -&gt; Shape
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">fromList</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; Shape
</span><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-var">Shape</span></a></span><span> </span><span class="annot"><span class="annottext">([Int64] -&gt; Shape) -&gt; ([Int64] -&gt; [Int64]) -&gt; [Int64] -&gt; Shape
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; [Int64]
forall l. IsList l =&gt; [Item l] -&gt; l
</span><span class="hs-identifier hs-var">fromList</span></span><span>
</span><span id="line-394"></span><span>    </span><span id="local-6989586621679164184"><span class="annot"><span class="annottext">toList :: Shape -&gt; [Item Shape]
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">toList</span></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span id="local-6989586621679164183"><span class="annot"><span class="annottext">ss :: [Int64]
</span><a href="#local-6989586621679164183"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; [Item [Int64]]
forall l. IsList l =&gt; l -&gt; [Item l]
</span><span class="hs-identifier hs-var">toList</span></span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164183"><span class="hs-identifier hs-var">ss</span></a></span><span>
</span><span id="line-395"></span><span>
</span><span id="line-396"></span><span class="annot"><a href="TensorFlow.Types.html#protoShape"><span class="hs-identifier hs-type">protoShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Lens'</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorShapeProto</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span>
</span><span id="line-397"></span><span id="protoShape"><span class="annot"><span class="annottext">protoShape :: LensLike' f TensorShapeProto Shape
</span><a href="TensorFlow.Types.html#protoShape"><span class="hs-identifier hs-var hs-var">protoShape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Resetter TensorShapeProto (f TensorShapeProto) Shape (f Shape)
-&gt; LensLike' f TensorShapeProto Shape
forall s t a b. Resetter s t a b -&gt; (a -&gt; b) -&gt; s -&gt; t
</span><span class="hs-identifier hs-var">under</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TensorShapeProto -&gt; Shape)
-&gt; (Shape -&gt; TensorShapeProto)
-&gt; Adapter TensorShapeProto TensorShapeProto Shape Shape
forall s a b t. (s -&gt; a) -&gt; (b -&gt; t) -&gt; Adapter s t a b
</span><span class="hs-identifier hs-var">adapter</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto -&gt; Shape
</span><a href="#local-6989586621679164182"><span class="hs-identifier hs-var">protoToShape</span></a></span><span> </span><span class="annot"><span class="annottext">Shape -&gt; TensorShapeProto
</span><a href="#local-6989586621679164181"><span class="hs-identifier hs-var">shapeToProto</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-399"></span><span>    </span><span id="local-6989586621679164182"><span class="annot"><span class="annottext">protoToShape :: TensorShapeProto -&gt; Shape
</span><a href="#local-6989586621679164182"><span class="hs-identifier hs-var hs-var">protoToShape</span></a></span></span><span> </span><span id="local-6989586621679164180"><span class="annot"><span class="annottext">p :: TensorShapeProto
</span><a href="#local-6989586621679164180"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Maybe Shape -&gt; Shape
forall a. a -&gt; Maybe a -&gt; a
</span><span class="hs-identifier hs-var">fromMaybe</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Char] -&gt; Shape
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><a href="#local-6989586621679164179"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FoldLike
  (Maybe Shape)
  TensorShapeProto
  TensorShapeProto
  (Maybe Shape)
  (Maybe Shape)
-&gt; TensorShapeProto -&gt; Maybe Shape
forall a s t b. FoldLike a s t a b -&gt; s -&gt; a
</span><span class="hs-identifier hs-var">view</span></span><span> </span><span class="annot"><span class="annottext">FoldLike
  (Maybe Shape)
  TensorShapeProto
  TensorShapeProto
  (Maybe Shape)
  (Maybe Shape)
Lens' TensorShapeProto (Maybe Shape)
</span><a href="TensorFlow.Types.html#protoMaybeShape"><span class="hs-identifier hs-var">protoMaybeShape</span></a></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
</span><a href="#local-6989586621679164180"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-400"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679164179"><span class="annot"><span class="annottext">msg :: [Char]
</span><a href="#local-6989586621679164179"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Can't convert TensorShapeProto with unknown rank to Shape: &quot;</span></span><span>
</span><span id="line-401"></span><span>                  </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto -&gt; [Char]
forall msg. Message msg =&gt; msg -&gt; [Char]
</span><span class="hs-identifier hs-var">showMessageShort</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
</span><a href="#local-6989586621679164180"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-402"></span><span>    </span><span id="local-6989586621679164181"><span class="annot"><span class="annottext">shapeToProto :: Shape -&gt; TensorShapeProto
</span><a href="#local-6989586621679164181"><span class="hs-identifier hs-var hs-var">shapeToProto</span></a></span></span><span> </span><span id="local-6989586621679164177"><span class="annot"><span class="annottext">s' :: Shape
</span><a href="#local-6989586621679164177"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
forall msg. Message msg =&gt; msg
</span><span class="hs-identifier hs-var">defMessage</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
-&gt; (TensorShapeProto -&gt; TensorShapeProto) -&gt; TensorShapeProto
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">Lens' TensorShapeProto (Maybe Shape)
forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f TensorShapeProto (Maybe Shape)
</span><a href="TensorFlow.Types.html#protoMaybeShape"><span class="hs-identifier hs-var">protoMaybeShape</span></a></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f TensorShapeProto (Maybe Shape))
-&gt; Maybe Shape -&gt; TensorShapeProto -&gt; TensorShapeProto
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Maybe Shape
forall a. a -&gt; Maybe a
</span><span class="hs-identifier hs-var">Just</span></span><span> </span><span class="annot"><span class="annottext">Shape
</span><a href="#local-6989586621679164177"><span class="hs-identifier hs-var">s'</span></a></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="annot"><a href="TensorFlow.Types.html#protoMaybeShape"><span class="hs-identifier hs-type">protoMaybeShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Lens'</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorShapeProto</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Maybe</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-405"></span><span id="protoMaybeShape"><span class="annot"><span class="annottext">protoMaybeShape :: LensLike' f TensorShapeProto (Maybe Shape)
</span><a href="TensorFlow.Types.html#protoMaybeShape"><span class="hs-identifier hs-var hs-var">protoMaybeShape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Resetter
  TensorShapeProto
  (f TensorShapeProto)
  (Maybe Shape)
  (f (Maybe Shape))
-&gt; LensLike' f TensorShapeProto (Maybe Shape)
forall s t a b. Resetter s t a b -&gt; (a -&gt; b) -&gt; s -&gt; t
</span><span class="hs-identifier hs-var">under</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TensorShapeProto -&gt; Maybe Shape)
-&gt; (Maybe Shape -&gt; TensorShapeProto)
-&gt; Adapter
     TensorShapeProto TensorShapeProto (Maybe Shape) (Maybe Shape)
forall s a b t. (s -&gt; a) -&gt; (b -&gt; t) -&gt; Adapter s t a b
</span><span class="hs-identifier hs-var">adapter</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto -&gt; Maybe Shape
</span><a href="#local-6989586621679164176"><span class="hs-identifier hs-var">protoToShape</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Shape -&gt; TensorShapeProto
</span><a href="#local-6989586621679164175"><span class="hs-identifier hs-var">shapeToProto</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-407"></span><span>    </span><span class="annot"><a href="#local-6989586621679164176"><span class="hs-identifier hs-type">protoToShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorShapeProto</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Maybe</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span>
</span><span id="line-408"></span><span>    </span><span id="local-6989586621679164176"><span class="annot"><span class="annottext">protoToShape :: TensorShapeProto -&gt; Maybe Shape
</span><a href="#local-6989586621679164176"><span class="hs-identifier hs-var hs-var">protoToShape</span></a></span></span><span> </span><span id="local-6989586621679164174"><span class="annot"><span class="annottext">p :: TensorShapeProto
</span><a href="#local-6989586621679164174"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-409"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">FoldLike Bool TensorShapeProto TensorShapeProto Bool Bool
-&gt; TensorShapeProto -&gt; Bool
forall a s t b. FoldLike a s t a b -&gt; s -&gt; a
</span><span class="hs-identifier hs-var">view</span></span><span> </span><span class="annot"><span class="annottext">FoldLike Bool TensorShapeProto TensorShapeProto Bool Bool
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;unknownRank&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">unknownRank</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
</span><a href="#local-6989586621679164174"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-410"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe Shape
forall a. Maybe a
</span><span class="hs-identifier hs-var">Nothing</span></span><span>
</span><span id="line-411"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Maybe Shape
forall a. a -&gt; Maybe a
</span><span class="hs-identifier hs-var">Just</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int64] -&gt; Shape
</span><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-var">Shape</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TensorShapeProto
</span><a href="#local-6989586621679164174"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
-&gt; Fold TensorShapeProto TensorShapeProto Int64 Int64 -&gt; [Int64]
forall s t a b. s -&gt; Fold s t a b -&gt; [a]
</span><span class="hs-operator hs-var">^..</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorShapeProto [TensorShapeProto'Dim]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;dim&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">dim</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f TensorShapeProto [TensorShapeProto'Dim]
-&gt; ((Int64 -&gt; f Int64)
    -&gt; [TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim])
-&gt; (Int64 -&gt; f Int64)
-&gt; TensorShapeProto
-&gt; f TensorShapeProto
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(TensorShapeProto'Dim -&gt; f TensorShapeProto'Dim)
-&gt; [TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><span class="hs-identifier hs-var">traverse</span></span><span> </span><span class="annot"><span class="annottext">((TensorShapeProto'Dim -&gt; f TensorShapeProto'Dim)
 -&gt; [TensorShapeProto'Dim] -&gt; f [TensorShapeProto'Dim])
-&gt; ((Int64 -&gt; f Int64)
    -&gt; TensorShapeProto'Dim -&gt; f TensorShapeProto'Dim)
-&gt; (Int64 -&gt; f Int64)
-&gt; [TensorShapeProto'Dim]
-&gt; f [TensorShapeProto'Dim]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; f Int64)
-&gt; TensorShapeProto'Dim -&gt; f TensorShapeProto'Dim
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;size&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">size</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-412"></span><span>    </span><span class="annot"><a href="#local-6989586621679164175"><span class="hs-identifier hs-type">shapeToProto</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Maybe</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorShapeProto</span></span><span>
</span><span id="line-413"></span><span>    </span><span id="local-6989586621679164175"><span class="annot"><span class="annottext">shapeToProto :: Maybe Shape -&gt; TensorShapeProto
</span><a href="#local-6989586621679164175"><span class="hs-identifier hs-var hs-var">shapeToProto</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Nothing</span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-414"></span><span>        </span><span class="annot"><span class="annottext">TensorShapeProto
forall msg. Message msg =&gt; msg
</span><span class="hs-identifier hs-var">defMessage</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
-&gt; (TensorShapeProto -&gt; TensorShapeProto) -&gt; TensorShapeProto
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f TensorShapeProto Bool
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;unknownRank&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">unknownRank</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f TensorShapeProto Bool)
-&gt; Bool -&gt; TensorShapeProto -&gt; TensorShapeProto
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-415"></span><span>    </span><span class="annot"><a href="#local-6989586621679164175"><span class="hs-identifier hs-var">shapeToProto</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Just</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span id="local-6989586621679164172"><span class="annot"><span class="annottext">ds :: [Int64]
</span><a href="#local-6989586621679164172"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-416"></span><span>        </span><span class="annot"><span class="annottext">TensorShapeProto
forall msg. Message msg =&gt; msg
</span><span class="hs-identifier hs-var">defMessage</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto
-&gt; (TensorShapeProto -&gt; TensorShapeProto) -&gt; TensorShapeProto
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f TensorShapeProto [TensorShapeProto'Dim]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;dim&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">dim</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f TensorShapeProto [TensorShapeProto'Dim])
-&gt; [TensorShapeProto'Dim] -&gt; TensorShapeProto -&gt; TensorShapeProto
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; TensorShapeProto'Dim)
-&gt; [Int64] -&gt; [TensorShapeProto'Dim]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-identifier hs-var">fmap</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679164171"><span class="annot"><span class="annottext">d :: Int64
</span><a href="#local-6989586621679164171"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TensorShapeProto'Dim
forall msg. Message msg =&gt; msg
</span><span class="hs-identifier hs-var">defMessage</span></span><span> </span><span class="annot"><span class="annottext">TensorShapeProto'Dim
-&gt; (TensorShapeProto'Dim -&gt; TensorShapeProto'Dim)
-&gt; TensorShapeProto'Dim
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f TensorShapeProto'Dim Int64
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;size&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">size</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f TensorShapeProto'Dim Int64)
-&gt; Int64 -&gt; TensorShapeProto'Dim -&gt; TensorShapeProto'Dim
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Int64
</span><a href="#local-6989586621679164171"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Int64]
</span><a href="#local-6989586621679164172"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-417"></span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span class="hs-keyword">class</span><span> </span><span id="Attribute"><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-var">Attribute</span></a></span></span><span> </span><span id="local-6989586621679164751"><span class="annot"><a href="#local-6989586621679164751"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-420"></span><span>    </span><span id="attrLens"><span class="annot"><a href="TensorFlow.Types.html#attrLens"><span class="hs-identifier hs-type">attrLens</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Lens'</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">AttrValue</span></span><span> </span><span class="annot"><a href="#local-6989586621679164751"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-423"></span><span>    </span><span id="local-6989586621679164167"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue Float
</span><a href="#local-6989586621679164167"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue Float
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;f&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">f</span></span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-426"></span><span>    </span><span id="local-6989586621679164165"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue ByteString
</span><a href="#local-6989586621679164165"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue ByteString
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;s&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">s</span></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-429"></span><span>    </span><span id="local-6989586621679164163"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue Int64
</span><a href="#local-6989586621679164163"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue Int64
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;i&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">i</span></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-432"></span><span>    </span><span id="local-6989586621679164161"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue DataType
</span><a href="#local-6989586621679164161"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue DataType
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;type'&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">type'</span></span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorProto</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-435"></span><span>    </span><span id="local-6989586621679164159"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue TensorProto
</span><a href="#local-6989586621679164159"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue TensorProto
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;tensor&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">tensor</span></span><span>
</span><span id="line-436"></span><span>
</span><span id="line-437"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-438"></span><span>    </span><span id="local-6989586621679164157"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue Bool
</span><a href="#local-6989586621679164157"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue Bool
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;b&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">b</span></span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-441"></span><span>    </span><span id="local-6989586621679164155"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue Shape
</span><a href="#local-6989586621679164155"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue TensorShapeProto
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;shape&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">shape</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue TensorShapeProto
-&gt; ((Shape -&gt; f Shape) -&gt; TensorShapeProto -&gt; f TensorShapeProto)
-&gt; LensLike' f AttrValue Shape
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Shape -&gt; f Shape) -&gt; TensorShapeProto -&gt; f TensorShapeProto
Lens' TensorShapeProto Shape
</span><a href="TensorFlow.Types.html#protoShape"><span class="hs-identifier hs-var">protoShape</span></a></span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Maybe</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Shape"><span class="hs-identifier hs-type">Shape</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-444"></span><span>    </span><span id="local-6989586621679164153"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue (Maybe Shape)
</span><a href="#local-6989586621679164153"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue TensorShapeProto
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;shape&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">shape</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue TensorShapeProto
-&gt; ((Maybe Shape -&gt; f (Maybe Shape))
    -&gt; TensorShapeProto -&gt; f TensorShapeProto)
-&gt; LensLike' f AttrValue (Maybe Shape)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Maybe Shape -&gt; f (Maybe Shape))
-&gt; TensorShapeProto -&gt; f TensorShapeProto
Lens' TensorShapeProto (Maybe Shape)
</span><a href="TensorFlow.Types.html#protoMaybeShape"><span class="hs-identifier hs-var">protoMaybeShape</span></a></span><span>
</span><span id="line-445"></span><span>
</span><span id="line-446"></span><span class="hs-comment">-- TODO(gnezdo): support generating list(Foo) from [Foo].</span><span>
</span><span id="line-447"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">AttrValue'ListValue</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-448"></span><span>    </span><span id="local-6989586621679164151"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue AttrValue'ListValue
</span><a href="#local-6989586621679164151"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue AttrValue'ListValue
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;list&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">list</span></span><span>
</span><span id="line-449"></span><span>
</span><span id="line-450"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span class="hs-special">]</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-451"></span><span>    </span><span id="local-6989586621679164149"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue [DataType]
</span><a href="#local-6989586621679164149"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue AttrValue'ListValue
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;list&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">list</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue AttrValue'ListValue
-&gt; (([DataType] -&gt; f [DataType])
    -&gt; AttrValue'ListValue -&gt; f AttrValue'ListValue)
-&gt; LensLike' f AttrValue [DataType]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">([DataType] -&gt; f [DataType])
-&gt; AttrValue'ListValue -&gt; f AttrValue'ListValue
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;type'&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">type'</span></span><span>
</span><span id="line-452"></span><span>
</span><span id="line-453"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Attribute"><span class="hs-identifier hs-type">Attribute</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span class="hs-special">]</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-454"></span><span>    </span><span id="local-6989586621679164147"><span class="annot"><span class="annottext">attrLens :: LensLike' f AttrValue [Int64]
</span><a href="#local-6989586621679164147"><span class="hs-identifier hs-var hs-var hs-var hs-var">attrLens</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue AttrValue'ListValue
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;list&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">list</span></span><span> </span><span class="annot"><span class="annottext">LensLike' f AttrValue AttrValue'ListValue
-&gt; (([Int64] -&gt; f [Int64])
    -&gt; AttrValue'ListValue -&gt; f AttrValue'ListValue)
-&gt; LensLike' f AttrValue [Int64]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">([Int64] -&gt; f [Int64])
-&gt; AttrValue'ListValue -&gt; f AttrValue'ListValue
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;i&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">i</span></span><span>
</span><span id="line-455"></span><span>
</span><span id="line-456"></span><span class="hs-comment">-- | A heterogeneous list type.</span><span>
</span><span id="line-457"></span><span class="hs-keyword">data</span><span> </span><span id="ListOf"><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-var">ListOf</span></a></span></span><span> </span><span id="local-6989586621679164146"><span class="annot"><a href="#local-6989586621679164146"><span class="hs-identifier hs-type">f</span></a></span></span><span> </span><span id="local-6989586621679164145"><span class="annot"><a href="#local-6989586621679164145"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-458"></span><span>    </span><span id="local-6989586621679164683"><span id="Nil"><span class="annot"><a href="TensorFlow.Types.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164683"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span></span><span>
</span><span id="line-459"></span><span>    </span><span id="local-6989586621679164142"><span id="local-6989586621679164143"><span id="local-6989586621679164697"><span id="%3A%2F"><span class="annot"><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-var">(:/)</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164697"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164143"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164697"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164142"><span class="hs-keyword hs-type">as</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164697"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164143"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span class="annot"><a href="#local-6989586621679164142"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-460"></span><span>
</span><span id="line-461"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-type">:/</span></a></span><span>
</span><span id="line-462"></span><span>
</span><span id="line-463"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="All"><span class="annot"><a href="TensorFlow.Types.html#All"><span class="hs-identifier hs-var">All</span></a></span></span><span> </span><span id="local-6989586621679164140"><span class="annot"><a href="#local-6989586621679164140"><span class="hs-identifier hs-type">f</span></a></span></span><span> </span><span id="local-6989586621679164139"><span class="annot"><a href="#local-6989586621679164139"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Constraint</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-464"></span><span>    </span><span id="All"><span class="annot"><a href="TensorFlow.Types.html#All"><span class="hs-identifier hs-var">All</span></a></span></span><span> </span><span id="local-6989586621679164138"><span class="annot"><a href="#local-6989586621679164138"><span class="hs-identifier hs-type hs-type">f</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-465"></span><span>    </span><span id="All"><span class="annot"><a href="TensorFlow.Types.html#All"><span class="hs-identifier hs-var">All</span></a></span></span><span> </span><span id="local-6989586621679164137"><span class="annot"><a href="#local-6989586621679164137"><span class="hs-identifier hs-type hs-type">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164136"><span class="annot"><a href="#local-6989586621679164136"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164135"><span class="annot"><a href="#local-6989586621679164135"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164137"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164136"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#All"><span class="hs-identifier hs-type">All</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164137"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164135"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span>
</span><span id="line-467"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="Map"><span class="annot"><a href="TensorFlow.Types.html#Map"><span class="hs-identifier hs-var">Map</span></a></span></span><span> </span><span id="local-6989586621679164134"><span class="annot"><a href="#local-6989586621679164134"><span class="hs-identifier hs-type">f</span></a></span></span><span> </span><span id="local-6989586621679164133"><span class="annot"><a href="#local-6989586621679164133"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-468"></span><span>    </span><span id="Map"><span class="annot"><a href="TensorFlow.Types.html#Map"><span class="hs-identifier hs-var">Map</span></a></span></span><span> </span><span id="local-6989586621679164132"><span class="annot"><a href="#local-6989586621679164132"><span class="hs-identifier hs-type hs-type">f</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-469"></span><span>    </span><span id="Map"><span class="annot"><a href="TensorFlow.Types.html#Map"><span class="hs-identifier hs-var">Map</span></a></span></span><span> </span><span id="local-6989586621679164131"><span class="annot"><a href="#local-6989586621679164131"><span class="hs-identifier hs-type hs-type">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164130"><span class="annot"><a href="#local-6989586621679164130"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164129"><span class="annot"><a href="#local-6989586621679164129"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="#local-6989586621679164131"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164131"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164129"><span class="hs-keyword hs-type">as</span></a></span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span id="local-6989586621679164127"><span id="local-6989586621679164128"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679164124"><span class="annot"><a href="TensorFlow.Types.html#All"><span class="hs-identifier hs-type">All</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164128"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164127"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164128"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164127"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-472"></span><span>    </span><span class="annot"><a href="TensorFlow.Types.html#Nil"><span class="hs-identifier hs-type">Nil</span></a></span><span> </span><span id="local-6989586621679164123"><span class="annot"><span class="annottext">== :: ListOf f as -&gt; ListOf f as -&gt; Bool
</span><span class="hs-operator hs-var hs-var hs-var hs-var">==</span></span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Nil"><span class="hs-identifier hs-type">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-473"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679164122"><span class="annot"><span class="annottext">x :: f a
</span><a href="#local-6989586621679164122"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-type">:/</span></a></span><span> </span><span id="local-6989586621679164121"><span class="annot"><span class="annottext">xs :: ListOf f as
</span><a href="#local-6989586621679164121"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-operator hs-var">==</span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164120"><span class="annot"><span class="annottext">y :: f a
</span><a href="#local-6989586621679164120"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-type">:/</span></a></span><span> </span><span id="local-6989586621679164119"><span class="annot"><span class="annottext">ys :: ListOf f as
</span><a href="#local-6989586621679164119"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">f a
</span><a href="#local-6989586621679164122"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">f a -&gt; f a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">f a
f a
</span><a href="#local-6989586621679164120"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">ListOf f as
</span><a href="#local-6989586621679164121"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">ListOf f as -&gt; ListOf f as -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ListOf f as
ListOf f as
</span><a href="#local-6989586621679164119"><span class="hs-identifier hs-var">ys</span></a></span></span></span><span>
</span><span id="line-474"></span><span>    </span><span class="hs-comment">-- Newer versions of GHC use the GADT to tell that the previous cases are</span><span>
</span><span id="line-475"></span><span>    </span><span class="hs-comment">-- exhaustive.</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &lt; 800
</span><span>    </span><span class="hs-identifier">_</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">False</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-480"></span><span id="local-6989586621679164116"><span id="local-6989586621679164117"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679164111"><span id="local-6989586621679164113"><span class="annot"><a href="TensorFlow.Types.html#All"><span class="hs-identifier hs-type">All</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Show</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164117"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164116"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Show</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164117"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164116"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-481"></span><span>    </span><span id="local-6989586621679164110"><span class="annot"><span class="annottext">showsPrec :: Int -&gt; ListOf f as -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">showsPrec</span></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Nil"><span class="hs-identifier hs-type">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var">showString</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Nil&quot;</span></span><span>
</span><span id="line-482"></span><span>    </span><span class="annot"><span class="hs-identifier hs-var">showsPrec</span></span><span> </span><span id="local-6989586621679164107"><span class="annot"><span class="annottext">d :: Int
</span><a href="#local-6989586621679164107"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164106"><span class="annot"><span class="annottext">x :: f a
</span><a href="#local-6989586621679164106"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-type">:/</span></a></span><span> </span><span id="local-6989586621679164105"><span class="annot"><span class="annottext">xs :: ListOf f as
</span><a href="#local-6989586621679164105"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var">showParen</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679164107"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="hs-number">10</span></span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>                                </span><span class="annot"><span class="annottext">(([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char])
-&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; f a -&gt; [Char] -&gt; [Char]
forall a. Show a =&gt; Int -&gt; a -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var">showsPrec</span></span><span> </span><span class="annot"><span class="hs-number">6</span></span><span> </span><span class="annot"><span class="annottext">f a
</span><a href="#local-6989586621679164106"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">([Char] -&gt; [Char]) -&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var">showString</span></span><span> </span><span class="annot"><span class="hs-string">&quot; :/ &quot;</span></span><span>
</span><span id="line-484"></span><span>                                    </span><span class="annot"><span class="annottext">([Char] -&gt; [Char]) -&gt; ([Char] -&gt; [Char]) -&gt; [Char] -&gt; [Char]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ListOf f as -&gt; [Char] -&gt; [Char]
forall a. Show a =&gt; Int -&gt; a -&gt; [Char] -&gt; [Char]
</span><span class="hs-identifier hs-var">showsPrec</span></span><span> </span><span class="annot"><span class="hs-number">6</span></span><span> </span><span class="annot"><span class="annottext">ListOf f as
</span><a href="#local-6989586621679164105"><span class="hs-identifier hs-var">xs</span></a></span></span></span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span class="hs-keyword">type</span><span> </span><span id="List"><span class="annot"><a href="TensorFlow.Types.html#List"><span class="hs-identifier hs-var">List</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Identity</span></span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span class="hs-comment">-- | Equivalent of ':/' for lists.</span><span>
</span><span id="line-489"></span><span id="local-6989586621679164101"><span id="local-6989586621679164102"><span class="annot"><a href="TensorFlow.Types.html#%2F%3A%2F"><span class="hs-operator hs-type">(/:/)</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164102"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#List"><span class="hs-identifier hs-type">List</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164101"><span class="hs-keyword hs-type">as</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#List"><span class="hs-identifier hs-type">List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164102"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span class="annot"><a href="#local-6989586621679164101"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-490"></span><span id="%2F%3A%2F"><span class="annot"><span class="annottext">/:/ :: a -&gt; List as -&gt; List (a : as)
</span><a href="TensorFlow.Types.html#%2F%3A%2F"><span class="hs-operator hs-var hs-var">(/:/)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Identity a -&gt; List as -&gt; List (a : as)
forall (f :: * -&gt; *) a (as :: [*]).
f a -&gt; ListOf f as -&gt; ListOf f (a : as)
</span><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-var">(:/)</span></a></span><span> </span><span class="annot"><span class="annottext">(Identity a -&gt; List as -&gt; List (a : as))
-&gt; (a -&gt; Identity a) -&gt; a -&gt; List as -&gt; List (a : as)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Identity a
forall a. a -&gt; Identity a
</span><span class="hs-identifier hs-var">Identity</span></span><span>
</span><span id="line-491"></span><span>
</span><span id="line-492"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3A%2F"><span class="hs-operator hs-type">/:/</span></a></span><span>
</span><span id="line-493"></span><span>
</span><span id="line-494"></span><span class="hs-comment">-- | A 'Constraint' specifying the possible choices of a 'TensorType'.</span><span>
</span><span id="line-495"></span><span class="hs-comment">--</span><span>
</span><span id="line-496"></span><span class="hs-comment">-- We implement a 'Constraint' like @OneOf '[Double, Float] a@ by turning the</span><span>
</span><span id="line-497"></span><span class="hs-comment">-- natural representation as a conjunction, i.e.,</span><span>
</span><span id="line-498"></span><span class="hs-comment">--</span><span>
</span><span id="line-499"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-500"></span><span class="hs-comment">--    a == Double || a == Float</span><span>
</span><span id="line-501"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-502"></span><span class="hs-comment">--</span><span>
</span><span id="line-503"></span><span class="hs-comment">-- into a disjunction like</span><span>
</span><span id="line-504"></span><span class="hs-comment">--</span><span>
</span><span id="line-505"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-506"></span><span class="hs-comment">--     a \/= Int32 &amp;&amp; a \/= Int64 &amp;&amp; a \/= ByteString &amp;&amp; ...</span><span>
</span><span id="line-507"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-508"></span><span class="hs-comment">--</span><span>
</span><span id="line-509"></span><span class="hs-comment">-- using an enumeration of all the possible 'TensorType's.</span><span>
</span><span id="line-510"></span><span class="hs-keyword">type</span><span> </span><span id="OneOf"><span class="annot"><a href="TensorFlow.Types.html#OneOf"><span class="hs-identifier hs-var">OneOf</span></a></span></span><span> </span><span id="local-6989586621679164099"><span class="annot"><a href="#local-6989586621679164099"><span class="hs-identifier hs-type">ts</span></a></span></span><span> </span><span id="local-6989586621679164098"><span class="annot"><a href="#local-6989586621679164098"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-511"></span><span>    </span><span class="hs-comment">-- Assert `TensorTypes' ts` to make error messages a little better.</span><span>
</span><span id="line-512"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164098"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-type">TensorTypes'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164099"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-type">NoneOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#AllTensorTypes"><span class="hs-identifier hs-type">AllTensorTypes</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator hs-type">\\</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164099"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679164098"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-513"></span><span>
</span><span id="line-514"></span><span class="hs-keyword">type</span><span> </span><span id="OneOfs"><span class="annot"><a href="TensorFlow.Types.html#OneOfs"><span class="hs-identifier hs-var">OneOfs</span></a></span></span><span> </span><span id="local-6989586621679164096"><span class="annot"><a href="#local-6989586621679164096"><span class="hs-identifier hs-type">ts</span></a></span></span><span> </span><span id="local-6989586621679164095"><span class="annot"><a href="#local-6989586621679164095"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier hs-type">TensorTypes</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164095"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-type">TensorTypes'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164096"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-515"></span><span>                        </span><span class="annot"><a href="TensorFlow.Types.html#NoneOfs"><span class="hs-identifier hs-type">NoneOfs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#AllTensorTypes"><span class="hs-identifier hs-type">AllTensorTypes</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator hs-type">\\</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164096"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679164095"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="NoneOfs"><span class="annot"><a href="TensorFlow.Types.html#NoneOfs"><span class="hs-identifier hs-var">NoneOfs</span></a></span></span><span> </span><span id="local-6989586621679164093"><span class="annot"><a href="#local-6989586621679164093"><span class="hs-identifier hs-type">ts</span></a></span></span><span> </span><span id="local-6989586621679164092"><span class="annot"><a href="#local-6989586621679164092"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Constraint</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-518"></span><span>    </span><span id="NoneOfs"><span class="annot"><a href="TensorFlow.Types.html#NoneOfs"><span class="hs-identifier hs-var">NoneOfs</span></a></span></span><span> </span><span id="local-6989586621679164091"><span class="annot"><a href="#local-6989586621679164091"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-519"></span><span>    </span><span id="NoneOfs"><span class="annot"><a href="TensorFlow.Types.html#NoneOfs"><span class="hs-identifier hs-var">NoneOfs</span></a></span></span><span> </span><span id="local-6989586621679164090"><span class="annot"><a href="#local-6989586621679164090"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164089"><span class="annot"><a href="#local-6989586621679164089"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164088"><span class="annot"><a href="#local-6989586621679164088"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-type">NoneOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164090"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164089"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOfs"><span class="hs-identifier hs-type">NoneOfs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164090"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164088"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span class="hs-keyword">data</span><span> </span><span id="TensorTypeProxy"><span class="annot"><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-var">TensorTypeProxy</span></a></span></span><span> </span><span id="local-6989586621679164087"><span class="annot"><a href="#local-6989586621679164087"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-522"></span><span>    </span><span id="local-6989586621679164680"><span id="TensorTypeProxy"><span class="annot"><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-var">TensorTypeProxy</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164680"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-type">TensorTypeProxy</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164680"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span class="hs-keyword">type</span><span> </span><span id="TensorTypeList"><span class="annot"><a href="TensorFlow.Types.html#TensorTypeList"><span class="hs-identifier hs-var">TensorTypeList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ListOf"><span class="hs-identifier hs-type">ListOf</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-type">TensorTypeProxy</span></a></span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span id="local-6989586621679164688"><span class="annot"><a href="TensorFlow.Types.html#fromTensorTypeList"><span class="hs-identifier hs-type">fromTensorTypeList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeList"><span class="hs-identifier hs-type">TensorTypeList</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164688"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span class="hs-special">]</span></span><span>
</span><span id="line-527"></span><span id="fromTensorTypeList"><span class="annot"><span class="annottext">fromTensorTypeList :: TensorTypeList ts -&gt; [DataType]
</span><a href="TensorFlow.Types.html#fromTensorTypeList"><span class="hs-identifier hs-var hs-var">fromTensorTypeList</span></a></span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Nil"><span class="hs-identifier hs-type">Nil</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-528"></span><span class="annot"><a href="TensorFlow.Types.html#fromTensorTypeList"><span class="hs-identifier hs-var">fromTensorTypeList</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679164085"><span class="annot"><span class="annottext">TensorTypeProxy a
</span><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-var">TensorTypeProxy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-type">TensorTypeProxy</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164085"><span class="hs-identifier hs-type">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-type">:/</span></a></span><span> </span><span id="local-6989586621679164084"><span class="annot"><span class="annottext">ts :: ListOf TensorTypeProxy as
</span><a href="#local-6989586621679164084"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><a href="TensorFlow.Types.html#tensorType"><span class="hs-identifier hs-var">tensorType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679164085"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DataType -&gt; [DataType] -&gt; [DataType]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">ListOf TensorTypeProxy as -&gt; [DataType]
forall (ts :: [*]). TensorTypeList ts -&gt; [DataType]
</span><a href="TensorFlow.Types.html#fromTensorTypeList"><span class="hs-identifier hs-var">fromTensorTypeList</span></a></span><span> </span><span class="annot"><span class="annottext">ListOf TensorTypeProxy as
</span><a href="#local-6989586621679164084"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span class="annot"><a href="TensorFlow.Types.html#fromTensorTypes"><span class="hs-identifier hs-type">fromTensorTypes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679164083"><span class="annot"><a href="#local-6989586621679164083"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier hs-type">TensorTypes</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164083"><span class="hs-keyword hs-type">as</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Proxy</span></span><span> </span><span class="annot"><a href="#local-6989586621679164083"><span class="hs-keyword hs-type">as</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span class="hs-special">]</span><span>
</span><span id="line-532"></span><span id="fromTensorTypes"><span class="annot"><span class="annottext">fromTensorTypes :: Proxy as -&gt; [DataType]
</span><a href="TensorFlow.Types.html#fromTensorTypes"><span class="hs-identifier hs-var hs-var">fromTensorTypes</span></a></span></span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorTypeList as -&gt; [DataType]
forall (ts :: [*]). TensorTypeList ts -&gt; [DataType]
</span><a href="TensorFlow.Types.html#fromTensorTypeList"><span class="hs-identifier hs-var">fromTensorTypeList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TensorTypeList as
forall (ts :: [*]). TensorTypes ts =&gt; TensorTypeList ts
</span><a href="TensorFlow.Types.html#tensorTypes"><span class="hs-identifier hs-var">tensorTypes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeList"><span class="hs-identifier hs-type">TensorTypeList</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164083"><span class="hs-keyword hs-type">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-533"></span><span>
</span><span id="line-534"></span><span class="hs-keyword">class</span><span> </span><span id="TensorTypes"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier hs-var">TensorTypes</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164685"><span class="annot"><a href="#local-6989586621679164685"><span class="hs-identifier hs-type">ts</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-operator">*</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-535"></span><span>    </span><span id="tensorTypes"><span class="annot"><a href="TensorFlow.Types.html#tensorTypes"><span class="hs-identifier hs-type">tensorTypes</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypeList"><span class="hs-identifier hs-type">TensorTypeList</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164685"><span class="hs-identifier hs-type">ts</span></a></span><span>
</span><span id="line-536"></span><span>
</span><span id="line-537"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier hs-type">TensorTypes</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-538"></span><span>    </span><span id="local-6989586621679164079"><span class="annot"><span class="annottext">tensorTypes :: TensorTypeList '[]
</span><a href="#local-6989586621679164079"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorTypes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorTypeList '[]
forall (f :: * -&gt; *). ListOf f '[]
</span><a href="TensorFlow.Types.html#Nil"><span class="hs-identifier hs-var">Nil</span></a></span><span>
</span><span id="line-539"></span><span>
</span><span id="line-540"></span><span class="hs-comment">-- | A constraint that the input is a list of 'TensorTypes'.</span><span>
</span><span id="line-541"></span><span id="local-6989586621679164077"><span id="local-6989586621679164078"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164078"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier hs-type">TensorTypes</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164077"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes"><span class="hs-identifier hs-type">TensorTypes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164078"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span class="annot"><a href="#local-6989586621679164077"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-542"></span><span>    </span><span id="local-6989586621679164075"><span class="annot"><span class="annottext">tensorTypes :: TensorTypeList (t : ts)
</span><a href="#local-6989586621679164075"><span class="hs-identifier hs-var hs-var hs-var hs-var">tensorTypes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TensorTypeProxy t
forall a. TensorType a =&gt; TensorTypeProxy a
</span><a href="TensorFlow.Types.html#TensorTypeProxy"><span class="hs-identifier hs-var">TensorTypeProxy</span></a></span><span> </span><span class="annot"><span class="annottext">TensorTypeProxy t
-&gt; ListOf TensorTypeProxy ts -&gt; TensorTypeList (t : ts)
forall (f :: * -&gt; *) a (as :: [*]).
f a -&gt; ListOf f as -&gt; ListOf f (a : as)
</span><a href="TensorFlow.Types.html#%3A%2F"><span class="hs-operator hs-var">:/</span></a></span><span> </span><span class="annot"><span class="annottext">ListOf TensorTypeProxy ts
forall (ts :: [*]). TensorTypes ts =&gt; TensorTypeList ts
</span><a href="TensorFlow.Types.html#tensorTypes"><span class="hs-identifier hs-var">tensorTypes</span></a></span></span></span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span class="hs-comment">-- | A simpler version of the 'TensorTypes' class, that doesn't run</span><span>
</span><span id="line-545"></span><span class="hs-comment">-- afoul of @-Wsimplifiable-class-constraints@.</span><span>
</span><span id="line-546"></span><span class="hs-comment">--</span><span>
</span><span id="line-547"></span><span class="hs-comment">-- In more detail: the constraint @OneOf '[Double, Float] a@ leads</span><span>
</span><span id="line-548"></span><span class="hs-comment">-- to the constraint @TensorTypes' '[Double, Float]@, as a safety-check</span><span>
</span><span id="line-549"></span><span class="hs-comment">-- to give better error messages.  However, if @TensorTypes'@ were a class,</span><span>
</span><span id="line-550"></span><span class="hs-comment">-- then GHC 8.2.1 would complain with the above warning unless @NoMonoBinds@</span><span>
</span><span id="line-551"></span><span class="hs-comment">-- were enabled.  So instead, we use a separate type family for this purpose.</span><span>
</span><span id="line-552"></span><span class="hs-comment">-- For more details: https://ghc.haskell.org/trac/ghc/ticket/11948</span><span>
</span><span id="line-553"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="TensorTypes%27"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-var">TensorTypes'</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164074"><span class="annot"><a href="#local-6989586621679164074"><span class="hs-identifier hs-type">ts</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-operator">*</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Constraint</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-554"></span><span>    </span><span class="hs-comment">-- Specialize this type family when `ts` is a long list, to avoid deeply</span><span>
</span><span id="line-555"></span><span>    </span><span class="hs-comment">-- nested tuples of constraints.  Works around a bug in ghc-8.0:</span><span>
</span><span id="line-556"></span><span>    </span><span class="hs-comment">-- https://ghc.haskell.org/trac/ghc/ticket/12175</span><span>
</span><span id="line-557"></span><span>    </span><span id="TensorTypes%27"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-var">TensorTypes'</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164073"><span class="annot"><a href="#local-6989586621679164073"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164072"><span class="annot"><a href="#local-6989586621679164072"><span class="hs-identifier hs-type hs-type">t2</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164071"><span class="annot"><a href="#local-6989586621679164071"><span class="hs-identifier hs-type hs-type">t3</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164070"><span class="annot"><a href="#local-6989586621679164070"><span class="hs-identifier hs-type hs-type">t4</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164069"><span class="annot"><a href="#local-6989586621679164069"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-558"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164073"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164072"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164071"><span class="hs-identifier hs-type">t3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164070"><span class="hs-identifier hs-type">t4</span></a></span><span>
</span><span id="line-559"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-type">TensorTypes'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164069"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-560"></span><span>    </span><span id="TensorTypes%27"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-var">TensorTypes'</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164068"><span class="annot"><a href="#local-6989586621679164068"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164067"><span class="annot"><a href="#local-6989586621679164067"><span class="hs-identifier hs-type hs-type">t2</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164066"><span class="annot"><a href="#local-6989586621679164066"><span class="hs-identifier hs-type hs-type">t3</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164065"><span class="annot"><a href="#local-6989586621679164065"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164068"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164067"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164066"><span class="hs-identifier hs-type">t3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-type">TensorTypes'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164065"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-562"></span><span>    </span><span id="TensorTypes%27"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-var">TensorTypes'</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164064"><span class="annot"><a href="#local-6989586621679164064"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164063"><span class="annot"><a href="#local-6989586621679164063"><span class="hs-identifier hs-type hs-type">t2</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164062"><span class="annot"><a href="#local-6989586621679164062"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-563"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164064"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164063"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-type">TensorTypes'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164062"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-564"></span><span>    </span><span id="TensorTypes%27"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-var">TensorTypes'</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164061"><span class="annot"><a href="#local-6989586621679164061"><span class="hs-identifier hs-type hs-type">t</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164060"><span class="annot"><a href="#local-6989586621679164060"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Types.html#TensorType"><span class="hs-identifier hs-type">TensorType</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164061"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-type">TensorTypes'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164060"><span class="hs-identifier hs-type">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-565"></span><span>    </span><span id="TensorTypes%27"><span class="annot"><a href="TensorFlow.Types.html#TensorTypes%27"><span class="hs-identifier hs-var">TensorTypes'</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span class="hs-comment">-- | A constraint checking that two types are different.</span><span>
</span><span id="line-568"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="local-6989586621679164059"><span class="annot"><a href="#local-6989586621679164059"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="%2F%3D"><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span></span><span> </span><span id="local-6989586621679164058"><span class="annot"><a href="#local-6989586621679164058"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Constraint</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-569"></span><span>    </span><span id="local-6989586621679164057"><span class="annot"><a href="#local-6989586621679164057"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span id="%2F%3D"><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span></span><span> </span><span class="annot"><a href="#local-6989586621679164057"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#TypeError"><span class="hs-identifier hs-type">TypeError</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164057"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><span class="hs-glyph hs-type">~</span></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#ExcludedCase"><span class="hs-identifier hs-type">ExcludedCase</span></a></span><span>
</span><span id="line-570"></span><span>    </span><span id="local-6989586621679164056"><span class="annot"><a href="#local-6989586621679164056"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span id="%2F%3D"><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span></span><span> </span><span id="local-6989586621679164055"><span class="annot"><a href="#local-6989586621679164055"><span class="hs-identifier hs-type hs-type">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span class="hs-comment">-- | Helper types to produce a reasonable type error message when the Constraint</span><span>
</span><span id="line-573"></span><span class="hs-comment">-- &quot;a /= a&quot; fails.</span><span>
</span><span id="line-574"></span><span class="hs-comment">-- TODO(judahjacobson): Use ghc-8's CustomTypeErrors for this.</span><span>
</span><span id="line-575"></span><span class="hs-keyword">data</span><span> </span><span id="TypeError"><span class="annot"><a href="TensorFlow.Types.html#TypeError"><span class="hs-identifier hs-var">TypeError</span></a></span></span><span> </span><span id="local-6989586621679164054"><span class="annot"><a href="#local-6989586621679164054"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-576"></span><span class="hs-keyword">data</span><span> </span><span id="ExcludedCase"><span class="annot"><a href="TensorFlow.Types.html#ExcludedCase"><span class="hs-identifier hs-var">ExcludedCase</span></a></span></span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span class="hs-comment">-- | An enumeration of all valid 'TensorType's.</span><span>
</span><span id="line-579"></span><span class="hs-keyword">type</span><span> </span><span id="AllTensorTypes"><span class="annot"><a href="TensorFlow.Types.html#AllTensorTypes"><span class="hs-identifier hs-var">AllTensorTypes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-580"></span><span>    </span><span class="hs-comment">-- NOTE: This list should be kept in sync with</span><span>
</span><span id="line-581"></span><span>    </span><span class="hs-comment">-- TensorFlow.OpGen.dtTypeToHaskell.</span><span>
</span><span id="line-582"></span><span>    </span><span class="hs-comment">-- TODO: Add support for Complex Float/Double.</span><span>
</span><span id="line-583"></span><span>    </span><span class="hs-special">'</span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span>
</span><span id="line-584"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span>
</span><span id="line-585"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int8</span></span><span>
</span><span id="line-586"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int16</span></span><span>
</span><span id="line-587"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int32</span></span><span>
</span><span id="line-588"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int64</span></span><span>
</span><span id="line-589"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word8</span></span><span>
</span><span id="line-590"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Word16</span></span><span>
</span><span id="line-591"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteString</span></span><span>
</span><span id="line-592"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-593"></span><span>     </span><span class="hs-special">]</span><span>
</span><span id="line-594"></span><span>
</span><span id="line-595"></span><span class="hs-comment">-- | Removes a type from the given list of types.</span><span>
</span><span id="line-596"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="Delete"><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-var">Delete</span></a></span></span><span> </span><span id="local-6989586621679164053"><span class="annot"><a href="#local-6989586621679164053"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679164052"><span class="annot"><a href="#local-6989586621679164052"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-597"></span><span>    </span><span id="Delete"><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-var">Delete</span></a></span></span><span> </span><span id="local-6989586621679164051"><span class="annot"><a href="#local-6989586621679164051"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-598"></span><span>    </span><span id="Delete"><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-var">Delete</span></a></span></span><span> </span><span id="local-6989586621679164050"><span class="annot"><a href="#local-6989586621679164050"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164050"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164049"><span class="annot"><a href="#local-6989586621679164049"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-type">Delete</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164050"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164049"><span class="hs-keyword hs-type">as</span></a></span><span>
</span><span id="line-599"></span><span>    </span><span id="Delete"><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-var">Delete</span></a></span></span><span> </span><span id="local-6989586621679164048"><span class="annot"><a href="#local-6989586621679164048"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164047"><span class="annot"><a href="#local-6989586621679164047"><span class="hs-identifier hs-type hs-type">b</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164046"><span class="annot"><a href="#local-6989586621679164046"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="#local-6989586621679164047"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-type">Delete</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164048"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164046"><span class="hs-keyword hs-type">as</span></a></span><span>
</span><span id="line-600"></span><span>
</span><span id="line-601"></span><span class="hs-comment">-- | Takes the difference of two lists of types.</span><span>
</span><span id="line-602"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="local-6989586621679164045"><span class="annot"><a href="#local-6989586621679164045"><span class="hs-keyword hs-type">as</span></a></span></span><span> </span><span id="%5C%5C"><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator hs-var">\\</span></a></span></span><span> </span><span id="local-6989586621679164044"><span class="annot"><a href="#local-6989586621679164044"><span class="hs-identifier hs-type">bs</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-603"></span><span>    </span><span id="local-6989586621679164043"><span class="annot"><a href="#local-6989586621679164043"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span> </span><span id="%5C%5C"><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator hs-var">\\</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="#local-6989586621679164043"><span class="hs-keyword hs-type">as</span></a></span><span>
</span><span id="line-604"></span><span>    </span><span id="local-6989586621679164042"><span class="annot"><a href="#local-6989586621679164042"><span class="hs-keyword hs-type hs-type">as</span></a></span></span><span> </span><span id="%5C%5C"><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator hs-var">\\</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164041"><span class="annot"><a href="#local-6989586621679164041"><span class="hs-identifier hs-type hs-type">b</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164040"><span class="annot"><a href="#local-6989586621679164040"><span class="hs-identifier hs-type hs-type">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#Delete"><span class="hs-identifier hs-type">Delete</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164041"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164042"><span class="hs-keyword hs-type">as</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%5C%5C"><span class="hs-operator hs-type">\\</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164040"><span class="hs-identifier hs-type">bs</span></a></span><span>
</span><span id="line-605"></span><span>
</span><span id="line-606"></span><span class="hs-comment">-- | A constraint that the type @a@ doesn't appear in the type list @ts@.</span><span>
</span><span id="line-607"></span><span class="hs-comment">-- Assumes that @a@ and each of the elements of @ts@ are 'TensorType's.</span><span>
</span><span id="line-608"></span><span class="hs-keyword">type</span><span> </span><span class="hs-keyword">family</span><span> </span><span id="NoneOf"><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-var">NoneOf</span></a></span></span><span> </span><span id="local-6989586621679164039"><span class="annot"><a href="#local-6989586621679164039"><span class="hs-identifier hs-type">ts</span></a></span></span><span> </span><span id="local-6989586621679164038"><span class="annot"><a href="#local-6989586621679164038"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Constraint</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-609"></span><span>    </span><span class="hs-comment">-- Specialize this type family when `ts` is a long list, to avoid deeply</span><span>
</span><span id="line-610"></span><span>    </span><span class="hs-comment">-- nested tuples of constraints.  Works around a bug in ghc-8.0:</span><span>
</span><span id="line-611"></span><span>    </span><span class="hs-comment">-- https://ghc.haskell.org/trac/ghc/ticket/12175</span><span>
</span><span id="line-612"></span><span>    </span><span id="NoneOf"><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-var">NoneOf</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164037"><span class="annot"><a href="#local-6989586621679164037"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164036"><span class="annot"><a href="#local-6989586621679164036"><span class="hs-identifier hs-type hs-type">t2</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164035"><span class="annot"><a href="#local-6989586621679164035"><span class="hs-identifier hs-type hs-type">t3</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164034"><span class="annot"><a href="#local-6989586621679164034"><span class="hs-identifier hs-type hs-type">t4</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164033"><span class="annot"><a href="#local-6989586621679164033"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164032"><span class="annot"><a href="#local-6989586621679164032"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span>
</span><span id="line-613"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164032"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164037"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679164032"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164036"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679164032"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164035"><span class="hs-identifier hs-type">t3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679164032"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164034"><span class="hs-identifier hs-type">t4</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-type">NoneOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164033"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164032"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span>    </span><span id="NoneOf"><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-var">NoneOf</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164031"><span class="annot"><a href="#local-6989586621679164031"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164030"><span class="annot"><a href="#local-6989586621679164030"><span class="hs-identifier hs-type hs-type">t2</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164029"><span class="annot"><a href="#local-6989586621679164029"><span class="hs-identifier hs-type hs-type">t3</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164028"><span class="annot"><a href="#local-6989586621679164028"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164027"><span class="annot"><a href="#local-6989586621679164027"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164031"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679164027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164030"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679164027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164029"><span class="hs-identifier hs-type">t3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-type">NoneOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164028"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164027"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-615"></span><span>    </span><span id="NoneOf"><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-var">NoneOf</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164026"><span class="annot"><a href="#local-6989586621679164026"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164025"><span class="annot"><a href="#local-6989586621679164025"><span class="hs-identifier hs-type hs-type">t2</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164024"><span class="annot"><a href="#local-6989586621679164024"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164023"><span class="annot"><a href="#local-6989586621679164023"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164023"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164026"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679164023"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164025"><span class="hs-identifier hs-type">t2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-type">NoneOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164024"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164023"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-616"></span><span>    </span><span id="NoneOf"><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-var">NoneOf</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679164022"><span class="annot"><a href="#local-6989586621679164022"><span class="hs-identifier hs-type hs-type">t1</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-glyph">:</span><span> </span><span id="local-6989586621679164021"><span class="annot"><a href="#local-6989586621679164021"><span class="hs-identifier hs-type hs-type">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679164020"><span class="annot"><a href="#local-6989586621679164020"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679164020"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="TensorFlow.Types.html#%2F%3D"><span class="hs-operator hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164022"><span class="hs-identifier hs-type">t1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-type">NoneOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164021"><span class="hs-identifier hs-type">ts</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679164020"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-617"></span><span>    </span><span id="NoneOf"><span class="annot"><a href="TensorFlow.Types.html#NoneOf"><span class="hs-identifier hs-var">NoneOf</span></a></span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621679164019"><span class="annot"><a href="#local-6989586621679164019"><span class="hs-identifier hs-type hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-618"></span></pre></body></html>